-
Notifications
You must be signed in to change notification settings - Fork 0
/
account_update.php
34 lines (33 loc) · 992 Bytes
/
account_update.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require('db_fetch.php');
// Query example: UPDATE account SET user_tel='10086' where user_id=1
// POST variables and generate query sentence
$user_id = $_COOKIE['this_id'];
$gender = $_POST['gender'];
$query = "UPDATE account SET user_gender='$gender'";
$id = $_COOKIE['this_tran_id'];
$fname = $_POST['fname'];
if ($fname!="") {
$query = $query.",user_fname ='$fname'";
}
$lname = $_POST['lname'];
if ($lname!="") {
$query = $query.",user_lname ='$lname'";
}
$tel = $_POST['tel'];
if ($tel!="") {
$query = $query.",user_tel ='$tel'";
}
$addr = $_POST['addr'];
if ($addr!="") {
$query = $query.",user_address ='$addr'";
}
$email = $_POST['email'];
if ($email!="") {
$query = $query.",user_email ='$email'";
}
$query = $query." where user_id=$user_id";
// Send query command and return success info
pg_query($db_connection, $query);
echo "<script type='text/javascript'>alert('Data Saved')</script>";
echo "<script> window.location.href = 'Account.php' </script>";