Home > Backend Development > PHP Tutorial > php里面的iframe页面出现SQL异常

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

WBOY
Release: 2016-06-13 13:27:12
Original
834 people have browsed it

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','')";


Copy after login


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

当然,你可能在准备回答我的问题时,就发现自己的问题所在了
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