Home > Backend Development > PHP Tutorial > mysql有关问题

mysql有关问题

WBOY
Release: 2016-06-13 13:37:29
Original
949 people have browsed it

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条执行的
------解决方案--------------------
。。只能一条一条的执行。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template