php裡面的iframe頁面出現SQL異常

來源:互聯網
上載者:User
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
//我就添加了這麼幾條//這一個是好的,查資料庫顯示資料寫進去了。$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 最後這個欄位 為'' 是不是有問題?
------解決方案--------------------
真夠可以的
原來的是什嗎?現在的是什嗎?
你都沒有說明!

當然,你可能在準備回答我的問題時,就發現自己的問題所在了
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.