SQL exception appears on IFRAME page inside PHP

Source: Internet
Author: User
SQL error occurred in the IFRAME page inside PHP
In making a shopping cart website.
I am in the home.php page right iframe a shopping cart, shopping_cart_form.php
Originally everything is good, I in home.php inside each product added a few text input what, in shopping_cart_form.php inside add a few sentence SQL.
But as soon as I add a little to the cart, the IFRAME will appear:
You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near "at line 1

I looked inside the shopping_cart_form.php and couldn't find anything wrong with SQL.
Later I replaced the shopping_cart_form.php with the normal code, unexpectedly also appeared wrong, before is good ah!

Home.php inside changed a few input, can affect the inside of the IFRAME?

    • PHP code
    • <!--code Highlighting produced by Actipro Codehighlighter (freeware)-->//I added so many//this one is good, check the database display data is written in. $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 ');//The following two have errors? This page is so much SQL. $query = "SELECT * from DISH WHERE dish_id = ' $dish _global_id '"; $query = "INSERT to 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 '
      ,'')";



------Solution--------------------
$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 The last field is "Is there a problem?"
------Solution--------------------
That's good enough.
What was the original? What is it now?
You didn't even explain!

Of course, you might be ready to answer my questions and find out where your problems are.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.