欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

mysql有关问题

程序员文章站 2022-04-27 19:25:45
...
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条执行的
------解决方案--------------------
。。只能一条一条的执行。
mysql有关问题

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频