Mysql problem $ sqlreturn & quot; updateborrow_bsetstate1wherebid & quot ;. $ min_bid [0]. & quot; andlicense_id & quot ;. $ _ SESSION [B _r_user]. & quot; andbook_no & quot; $ book_no & mysql problems
$ Sqlreturn = "update borrow_ B set state = 1 where bid = ". $ min_bid [0]. "and license_id = ". $ _ SESSION ['B _ r_user']. "and book_no = \" $ book_no \ "; insert into return_ B values (\"\",". $ _ SESSION ['B _ r_user']. ", \" $ book_no \",". $ _ SESSION ['login _ id']. ", now (); update book set stock = stock + 1 where book_no = \"". $ book_no. "\";";
$ Q1 = mysql_query ($ sqlreturn, $ conn );
I have tried every statement in phpadmin. it works. Why can't I put it together ??
Error message:
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 'Insert into return_ B values ("", 1827463521, "14353221", 0, now (); update' at line 2
Help !!
------ Solution --------------------
1. "update borrow_ B set state = 1 where bid = ". $ min_bid [0]. "and license_id = ". $ _ SESSION ['B _ r_user']. "and book_no = \" $ book_no \";
2. insert into return_ B values (\"\",". $ _ SESSION ['B _ r_user']. ", \" $ book_no \",". $ _ SESSION ['login _ id']. ", now ());
3. update book set stock = stock + 1 where book_no = \ "". $ book_no ."\";";
You have 3 commands!
Only one mysql_query can be executed!
In phpmyadmin, it can be split into three items for execution.
------ Solution --------------------
.. Only one execution can be performed.