Reputation: 5637
This is my SQL
statement:
UPDATE approved_student SET barcode='11',phone='11',table_name='2',remark='' WHERE
studentid='5230010'; UPDATE approved_student SET
barcode='22',phone='22',table_name='2',remark='' WHERE studentid='5230009';
Executing the SQL
using PHP
is not resulting in the desired outcome.
PHP
source:
mysql_connect("localhost","root","1234"); //connect database
mysql_select_db("lasto");//select name of the database
if($sql=mysql_query($data1)){
echo 1;
}else{
echo $data1;
}
mysql_close();
I sent the SQL
using POST
, but it does not work.
Upvotes: 1
Views: 138
Reputation: 446
You can only execute one commands at the time with mysql_query(), you should look at using mysqli or PDO instead.
mysql_query("UPDATE approved_student SET barcode='11',phone='11',table_name='2',remark='' WHERE
studentid='5230010'");
...
mysql_query("UPDATE approved_student SET
barcode='22',phone='22',table_name='2',remark='' WHERE studentid='5230009'");
Upvotes: 6