An SQL error occurs on the iframe page in php when you create a shopping cart website. I am at home. iframe is a shopping cart on the right side of the php page. shopping_cart_form.php has always done well. I am at home. several textinput or something are added to each item in php. an SQL error occurs on the iframe page in shopping_cart_form.php.
Make a shopping cart website.
I have a shopping cart in iframe on the right side of the home. php page, shopping_cart_form.php
Everything was fine. I added a few text inputs to each item in home. php and added several SQL statements to shopping_cart_form.php.
However, if I add it to the shopping cart at one point, the iframe will display:
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
I saw it in shopping_cart_form.php and couldn't find the SQL error.
Later, I changed shopping_cart_form.php to the previous normal code, and there was an error. it was good before!
How many inputs have been modified in home. php, which can affect the iframe?
PHP code
// I have added a few items. // This is good. check the database and show that the data has been 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') "; // are there two errors below? There are so many SQL statements on this page. $ 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 ','')";
------ 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 ','')";
The last field of shop_id is ''. Is there a problem?
------ Solution --------------------
Really good.
What is it? What is it now?
You did not explain it!
Of course, you may find your problem when preparing to answer my questions.