>  기사  >  백엔드 개발  >  php里面的iframe页面出现SQL异常

php里面的iframe页面出现SQL异常

WBOY
WBOY원래의
2016-06-13 13:27:12777검색

php里面的iframe页面出现SQL错误
在做一个购物车网站。
我在home.php页面右侧iframe一个购物车,shopping_cart_form.php
本来一切都好好的,我在home.php里面每个商品加了几个text input什么的,在shopping_cart_form.php里面加了几句SQL。
但是我只要一点 添加进购物车,iframe里面就会出现:
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 '' at line 1

我在shopping_cart_form.php里面看了,找不到SQL有啥错误。
后来我把shopping_cart_form.php换成以前正常的代码,居然也出现错误,以前是好好的啊!

难道home.php里面改了几个input,可以影响到iframe里面的?

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
//我就添加了这么几条
//这一个是好的,查数据库显示数据写进去了。
$query="INSERT INTO CART (username, dish_id, dish_qty, total_price, dest_id, shop_id) VALUES ('$username','$dish_id','$dish_qty','$dish_total_price','$dest_id','$shop_id')";
//下面两个有错误么?这个页面就这么多SQL了。
$query="SELECT * FROM DISH WHERE dish_id = '$dish_global_id'";
$query="INSERT INTO CART (username, dish_id, dish_qty, total_price, dest_id, shop_id) VALUES ('$username','$dish_global_id','$dish_global_qty','$dish_global_total','$dest_id','')";




------解决方案--------------------
$query="INSERT INTO CART (username, dish_id, dish_qty, total_price, dest_id, shop_id) VALUES ('$username','$dish_global_id','$dish_global_qty','$dish_global_total','$dest_id','')";

shop_id 最后这个字段 为'' 是不是有问题?
------解决方案--------------------
真够可以的
原来的是什么?现在的是什么?
你都没有说明!

当然,你可能在准备回答我的问题时,就发现自己的问题所在了
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.