473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Error In sql You have an error in your SQL syntax; check the manual that corresponds

i'm using order.php to input the data and
I am trying to create an additional data entry page from order.php and name the file as order_process.php

When I run the script I get the error message on order_process.php which is

Error In sql 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 'order values(' saad','saad','890601075030','0175958939','saad','s add@yahoo.co' at line 1


Can you tell me where I should be looking for this error?
I have compared my code with the original and cannot see anywhere where this error might come from.
Here's the first part of my script....[php]


Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.  
  4.     $username=$_GET["username"];
  5.     $fullname=$_POST["fullname"];
  6.     $icno=$_POST["icno"];
  7.     $phoneno=$_POST["phoneno"];
  8.     $address=$_POST["address"];
  9.     $email=$_POST["email"];
  10.  
  11.  
  12.     include("connect.php");
  13.  
  14.  
  15.     $pastry1 = $_POST['pastry1'];
  16.     $pastry2 = $_POST['pastry2'];
  17.     $pastry3 = $_POST['pastry3'];
  18.     $cakes1 = $_POST['cakes1'];
  19.     $cakes2 = $_POST['cakes2'];
  20.     $cakes3 = $_POST['cakes3'];
  21.  
  22.     $pastry1q1 = $_POST['pastry1q1'];
  23.     $pastry2q2 = $_POST['pastry2q2'];
  24.     $pastry3q3 = $_POST['pastry3q3'];
  25.     $cakes1q1 = $_POST['cakes1q1'];
  26.     $cakes2q2 = $_POST['cakes2q2'];
  27.     $cakes3q3 = $_POST['cakes3q3'];
  28.  
  29. //pastry type1
  30.         switch($pastry1)
  31.     {
  32.     case "Malaysian Pizza":
  33.         $price1 = "30.00";
  34.         $total1 = ($pastry1q1 * $price1);
  35.  
  36.         break;
  37.  
  38.     case "Spiral Cheese Stick":
  39.         $price1 = "30.00";
  40.         $total1 = ($pastry1q1 * $price1);
  41.  
  42.         break;
  43.  
  44.     case "Sweet Cheese Cone":
  45.         $price1 = "30.00";
  46.         $total1 = ($pastry1q1 * $price1);
  47.  
  48.         break;
  49.  
  50.     case "Portugese Egg Tarts":
  51.         $price1 = "30.00";
  52.         $total1 = ($pastry1q1 * $price1);
  53.  
  54.         break;
  55.  
  56.     case "Blueberry Cheese Tart":
  57.         $price1 = "30.00";
  58.         $total1 = ($pastry1q1 * $price1);
  59.  
  60.         break;
  61.  
  62.  
  63.     default:
  64.         $price1 = "0.00";
  65.         $total1= ($pastry1q1 * $price1);
  66.  
  67.         break;
  68.  
  69.  
  70. }
  71.  
  72. //pastry type 2
  73.  
  74.     switch($pastry2)
  75.     {
  76.     case "Malaysian Pizza":
  77.         $price2 = "30.00";
  78.         $total2 = ($pastry2q2 * $price2);
  79.  
  80.         break;
  81.  
  82.     case "Spiral Cheese Stick":
  83.         $price2 = "30.00";
  84.         $total2 = ($pastry2q2 * $price2);
  85.  
  86.         break;
  87.  
  88.     case "Sweet Cheese Cone":
  89.         $price2 = "30.00";
  90.         $total2 = ($pastry1q1 * $price2);
  91.  
  92.         break;
  93.  
  94.     case "Portugese Egg Tarts":
  95.         $price2 = "30.00";
  96.         $total2 = ($pastry2q2 * $price2);
  97.  
  98.         break;
  99.  
  100.     case "Blueberry Cheese Tart":
  101.         $price2 = "30.00";
  102.         $total2 = ($pastry2q2 * $price2);
  103.  
  104.         break;
  105.  
  106.  
  107.     default:
  108.         $price2 = "0.00";
  109.         $total2 = ($pastry2q2 * $price2);
  110.  
  111.         break;
  112.     }//close pastry type 2
  113.  
  114. //pastry type 3    
  115.     switch($pastry3)
  116.     {
  117.     case "Malaysian Pizza":
  118.         $price3 = "30.00";
  119.         $total3 = ($pastry3q3 * $price3);
  120.  
  121.         break;
  122.  
  123.     case "Spiral Cheese Stick":
  124.         $price3 = "30.00";
  125.         $total3 = ($pastry3q3 * $price3);
  126.  
  127.         break;
  128.  
  129.     case "Sweet Cheese Cone":
  130.         $price3 = "30.00";
  131.         $total3 = ($pastry1q1 * $price3);
  132.  
  133.         break;
  134.  
  135.     case "Portugese Egg Tarts":
  136.         $price3 = "30.00";
  137.         $total3 = ($pastry2q2 * $price3);
  138.  
  139.         break;
  140.  
  141.     case "Blueberry Cheese Tart":
  142.         $price3 = "30.00";
  143.         $total3 = ($pastry3q3 * $price3);
  144.  
  145.         break;
  146.  
  147.  
  148.     default:
  149.         $price3 = "0.00";
  150.         $total3 = ($pastry3q3 * $price3);
  151.  
  152.         break;
  153.     }//close pastry type 3 and end of all pastry type
  154.  
  155. //cakes type
  156.  
  157. //cakes type1
  158.  
  159. switch($cakes1)
  160.     {
  161.     case "Cheese Cakes":
  162.         $price4 = "70.00";
  163.         $total4 = ($cakes1q1 * $price4);
  164.  
  165.         break;
  166.  
  167.     case "Birthday Cakes":
  168.         $price4 = "70.00";
  169.         $total4 = ($cakes1q1 * $price4);
  170.  
  171.         break;
  172.  
  173.     case "Cream Cupcakes":
  174.         $price4 = "36.00";
  175.         $total4 = ($cakes1q1 * $price4);
  176.  
  177.         break;
  178.  
  179.     case "Chocolate Banana Muffin":
  180.         $price4 = "36.00";
  181.         $total4 = ($cakes1q1 * $price4);
  182.  
  183.         break;
  184.  
  185.     case "Black Forest Cakes":
  186.         $price4 = "70.00";
  187.         $total4 = ($cakes1q1 * $price4);
  188.  
  189.         break;
  190.  
  191.  
  192.     default:
  193.         $price4 = "0.00";
  194.         $total4 = ($cakes1q1 * $price4);
  195.  
  196.         break;
  197.     }// close cakes type1
  198.  
  199. //cakes type2    
  200.     switch($cakes2)
  201.     {
  202.     case "Cheese Cakes":
  203.         $price5 = "70.00";
  204.         $total5 = ($cakes2q2 * $price5);
  205.  
  206.         break;
  207.  
  208.     case "Birthday Cakes":
  209.         $price5 = "70.00";
  210.         $total5 = ($cakes2q2 * $price5);
  211.  
  212.         break;
  213.  
  214.     case "Cream Cupcakes":
  215.         $price5 = "36.00";
  216.         $total5 = ($cakes2q2 * $price5);
  217.  
  218.         break;
  219.  
  220.     case "Chocolate Banana Muffin":
  221.         $price5 = "36.00";
  222.         $total5 = ($cakes2q2 * $price5);
  223.  
  224.         break;
  225.  
  226.     case "Black Forest Cakes":
  227.         $price5 = "70.00";
  228.         $total5 = ($cakes2q2 * $price5);
  229.  
  230.         break;
  231.  
  232.  
  233.     default:
  234.         $price5 = "0.00";
  235.         $total5 = ($cakes2q2 * $price5);
  236.  
  237.         break;
  238.     }//close type 2
  239.  
  240.     //cakes type 3
  241.  
  242.     switch($cakes3)
  243.     {
  244.     case "Cheese Cakes":
  245.         $price6 = "70.00";
  246.         $total6 = ($cakes3q3 * $price6);
  247.  
  248.         break;
  249.  
  250.     case "Birthday Cakes":
  251.         $price6 = "70.00";
  252.         $total6 = ($cakes3q3 * $price6);
  253.  
  254.         break;
  255.  
  256.     case "Cream Cupcakes":
  257.         $price6 = "36.00";
  258.         $total6 = ($cakes3q3 * $price6);
  259.  
  260.         break;
  261.  
  262.     case "Chocolate Banana Muffin":
  263.         $price6 = "36.00";
  264.         $total6 = ($cakes3q3 * $price6);
  265.  
  266.         break;
  267.  
  268.     case "Black Forest Cakes":
  269.         $price6 = "70.00";
  270.         $total6 = ($cakes3q3 * $price6);
  271.  
  272.         break;
  273.  
  274.  
  275.     default:
  276.         $price6 = "0.00";
  277.         $total6 = ($cakes3q3 * $price6);
  278.  
  279.         break;
  280.     }//close type 3 and all cakes type
  281.  
  282.     $totalpay = $total1 + $total2 + $total3 + $total4 + $total5 + $total6 ;
  283.  
  284.  
  285.  
  286.     $insert_sql="INSERT  INTO order 
  287.     values('$username','$fullname','$icno','$phoneno','$address','$email','$pastry1','$pastry1q1','$pastry2','$pastry2q2','$pastry3','$pastry3q3','$cakes1','$cakes1q1','$cakes2','$cakes2q2','$cakes3','$cakes3q3''$totalpay',NOW())";
  288.         $result = mysql_query($insert_sql) or die ("Error In sql ".mysql_error());
  289.         if($result)
  290.         {
  291.             echo "<font color='white'><h1>Successfully Insert Data into database.</h1><br>";
  292.             echo "<font color = 'white'>Your order has been inserted to our database. Kindly Please Pay Your Booking Payment Within in 3                     
  293.             days.If you do not pay it we suggest that your are cancel your booking. Thank You.</font>";
  294.             echo "<font color='white'><a href='../main2.php'<h2>Click Here To Continue !</h2></a>";
  295.             }
  296.             else
  297.             {
  298.                 echo "Error In Inserting data.";
  299.                 }
  300.  
  301. ?>
Attached Files
File Type: txt order.txt (14.2 KB, 421 views)
File Type: txt order_process.txt (7.7 KB, 370 views)
Mar 16 '12 #1
1 2241
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

order is a reserved key word in SQL. Rename your table.
Mar 16 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: entoone | last post by:
I'm getting the following error Parse error: parse error, expecting `','' or `';'' in /home/notarywe/public_html/php/update2.php on line 108 Here is line 108 <input type="text" name="ud_first"...
3
by: Marten van Urk | last post by:
I got the following error in my page Parse error: parse error, unexpected T_ELSE in line 25 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Club</title>...
1
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. ...
2
by: Krzysztof Bartosiewicz | last post by:
Hi! I have problems with editing my VBA code. It is connected with some kind of automatic-correction mechanism in Access which I cannot find. I turned off Automatic Syntax Check in Options menu...
1
by: Annie | last post by:
Hi guys, I am trying to set the connection string for my database in the web.config file however it raises the funny error message: ""Error while trying to run project: Unable to start...
0
by: Subanesh | last post by:
Hi All, Am new to using HTMLUnit.I wrote a sample code(to emulate opening of website google.com and enter a value say "html" in the text field and click the Search button) .The code is as follows...
7
by: ajos | last post by:
hi friends, i have a problem in mysql query..when i click on submit the values get enterred but i get a ever since i did some changes in my code(earlier i was getting a null pointer...
21
by: missflorenceokosun | last post by:
hi, am florence. i keep having a runtime error stating error in update query syntax. i have looked through my code over and over gain and seem to find no flaw. i need you guys to help me out! ...
4
by: FM | last post by:
Hi there: My question is about checking my sql-syntax against DB2UDB V9 throug JDBC 2.0 Is there a way to check my syntax,for example "select * from T1"? Thank you for your help. Regards,
1
by: sathishauit | last post by:
<?php require_once ("inc/dbconnection.php"); class provider_function { public $select_query; public $select_result; public $insert_query; public $insert_result; public $update_query;
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.