Forum Moderators: coopster
maybe you have seen this question before But when i send data to my MySQL database i get the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE yourtable.id= 100' at line 5
This is a common error with mysql 4.1.* if you will google for it you will find hunderds of people who suffer under this.
This is the code which may has to be changed.
it would work on older versions of mysql but im not allowed to install:
//build and issue query
$sql ="UPDATE $table SET
order_status_manager = ".$_POST['order_status_manager'].",
order_status_finance = ".$_POST['order_status_finance'].",
order_status_it = ".$_POST['order_status_it'].",
WHERE $table.order_id = ".$_POST['order_id']."";$result = mysql_query($sql,$connection) or die(mysql_error());
I hope you guys can help me
You have an extra comma just before the 'WHERE'.
The code should read:
//build and issue query
$sql ="UPDATE $table SET
order_status_manager = ".$_POST['order_status_manager'].",
order_status_finance = ".$_POST['order_status_finance'].",
order_status_it = ".$_POST['order_status_it']."
WHERE $table.order_id = ".$_POST['order_id']."";
arran.
Assuming all 3 fields (order_status_manager, order_status_finance and order_status_it but not order_id) are String fields, try:
//build and issue query
$sql ="UPDATE $table SET
order_status_manager = '".$_POST['order_status_manager']."',
order_status_finance = '".$_POST['order_status_finance']."',
order_status_it = '".$_POST['order_status_it']."'
WHERE $table.order_id = ".$_POST['order_id']."";
arran.