mysql问题
$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);
每个语句我在phpadmin中都试过,都可以,放在一起query为什么不行??
出错信息是:
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
求助!!
------解决方案--------------------
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."\";";
你这是 3 条指令呀!
mysql_query 只允许执行一条!
phpmyadmin 中可以,是他拆成3条执行的
------解决方案--------------------
。。只能一条一条的执行。