Reputation: 21
Please guys I need you help on updating mysql database. Below is the code:
$sql_1 = "UPDATE tbl_courier
SET status = '$status',
comments = '$comments',
aarrival = '$aarrival',
transferdate = '$transferdate',
bl = '$bl',
`containerno` = '$containerno',
eta = '$eta',
rev_name = '$Receivername'
WHERE cid = $cid
AND cons_no = '$cons_no'";
dbQuery($sql_1);
Every column updates with the new input except containerno, eta and rev_name
What have i done wrong please help...
Upvotes: 0
Views: 82
Reputation: 31
As far as I can see, there is one line out of place. Change this:
$sql_1 = "UPDATE tbl_courier
SET status = '$status',
comments = '$comments',
aarrival = '$aarrival',
transferdate = '$transferdate',
bl = '$bl',
`containerno` = '$containerno',
eta = '$eta',
rev_name = '$Receivername'
WHERE cid = $cid
AND cons_no = '$cons_no'";
dbQuery($sql_1);
To this:
$sql_1 = "UPDATE tbl_courier
SET status = '$status',
comments = '$comments',
aarrival = '$aarrival',
transferdate = '$transferdate',
bl = '$bl',
containerno = '$containerno',
eta = '$eta',
rev_name = '$Receivername'
WHERE cid = $cid
AND cons_no = '$cons_no'";
dbQuery($sql_1);
It's this line here:
`containerno` = '$containerno',
I believe you do not need the tilda before and after the column.
Old line:
`containerno` = '$containerno',
New line:
containerno = '$containerno',
When you add the tildas, as you can see. It is causing the rest of the syntax to nullify.
Upvotes: 1