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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hakitazara
    New Member
    • Mar 2012
    • 1

    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.p hp

    When I run the script I get the error message on order_process.p hp 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','8 90601075030','0 175958939','saa d','sadd@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]


    Code:
    <?php
    
    	
    	$username=$_GET["username"];
    	$fullname=$_POST["fullname"];
    	$icno=$_POST["icno"];
    	$phoneno=$_POST["phoneno"];
    	$address=$_POST["address"];
    	$email=$_POST["email"];
    	
    	
    	include("connect.php");
    	
    	
    	$pastry1 = $_POST['pastry1'];
    	$pastry2 = $_POST['pastry2'];
    	$pastry3 = $_POST['pastry3'];
    	$cakes1 = $_POST['cakes1'];
    	$cakes2 = $_POST['cakes2'];
    	$cakes3 = $_POST['cakes3'];
    
    	$pastry1q1 = $_POST['pastry1q1'];
    	$pastry2q2 = $_POST['pastry2q2'];
    	$pastry3q3 = $_POST['pastry3q3'];
    	$cakes1q1 = $_POST['cakes1q1'];
    	$cakes2q2 = $_POST['cakes2q2'];
    	$cakes3q3 = $_POST['cakes3q3'];
    
    //pastry type1
    		switch($pastry1)
    	{
    	case "Malaysian Pizza":
    		$price1 = "30.00";
    		$total1 = ($pastry1q1 * $price1);
    		
    		break;
    	
    	case "Spiral Cheese Stick":
    		$price1 = "30.00";
    		$total1 = ($pastry1q1 * $price1);
    		
    		break;
    		
    	case "Sweet Cheese Cone":
    		$price1 = "30.00";
    		$total1 = ($pastry1q1 * $price1);
    		
    		break;
    		
    	case "Portugese Egg Tarts":
    		$price1 = "30.00";
    		$total1 = ($pastry1q1 * $price1);
    		
    		break;
    		
    	case "Blueberry Cheese Tart":
    		$price1 = "30.00";
    		$total1 = ($pastry1q1 * $price1);
    		
    		break;
    	
    	
    	default:
    		$price1 = "0.00";
    		$total1= ($pastry1q1 * $price1);
    		
    		break;
    	
    
    }
    
    //pastry type 2
    	
    	switch($pastry2)
    	{
    	case "Malaysian Pizza":
    		$price2 = "30.00";
    		$total2 = ($pastry2q2 * $price2);
    		
    		break;
    	
    	case "Spiral Cheese Stick":
    		$price2 = "30.00";
    		$total2 = ($pastry2q2 * $price2);
    		
    		break;
    		
    	case "Sweet Cheese Cone":
    		$price2 = "30.00";
    		$total2 = ($pastry1q1 * $price2);
    		
    		break;
    		
    	case "Portugese Egg Tarts":
    		$price2 = "30.00";
    		$total2 = ($pastry2q2 * $price2);
    		
    		break;
    		
    	case "Blueberry Cheese Tart":
    		$price2 = "30.00";
    		$total2 = ($pastry2q2 * $price2);
    		
    		break;
    	
    	
    	default:
    		$price2 = "0.00";
    		$total2 = ($pastry2q2 * $price2);
    		
    		break;
    	}//close pastry type 2
    	
    //pastry type 3	
    	switch($pastry3)
    	{
    	case "Malaysian Pizza":
    		$price3 = "30.00";
    		$total3 = ($pastry3q3 * $price3);
    		
    		break;
    	
    	case "Spiral Cheese Stick":
    		$price3 = "30.00";
    		$total3 = ($pastry3q3 * $price3);
    		
    		break;
    		
    	case "Sweet Cheese Cone":
    		$price3 = "30.00";
    		$total3 = ($pastry1q1 * $price3);
    		
    		break;
    		
    	case "Portugese Egg Tarts":
    		$price3 = "30.00";
    		$total3 = ($pastry2q2 * $price3);
    		
    		break;
    		
    	case "Blueberry Cheese Tart":
    		$price3 = "30.00";
    		$total3 = ($pastry3q3 * $price3);
    		
    		break;
    	
    	
    	default:
    		$price3 = "0.00";
    		$total3 = ($pastry3q3 * $price3);
    		
    		break;
    	}//close pastry type 3 and end of all pastry type
    	
    //cakes type
    
    //cakes type1
    
    switch($cakes1)
    	{
    	case "Cheese Cakes":
    		$price4 = "70.00";
    		$total4 = ($cakes1q1 * $price4);
    		
    		break;
    	
    	case "Birthday Cakes":
    		$price4 = "70.00";
    		$total4 = ($cakes1q1 * $price4);
    		
    		break;
    		
    	case "Cream Cupcakes":
    		$price4 = "36.00";
    		$total4 = ($cakes1q1 * $price4);
    		
    		break;
    		
    	case "Chocolate Banana Muffin":
    		$price4 = "36.00";
    		$total4 = ($cakes1q1 * $price4);
    		
    		break;
    		
    	case "Black Forest Cakes":
    		$price4 = "70.00";
    		$total4 = ($cakes1q1 * $price4);
    		
    		break;
    	
    	
    	default:
    		$price4 = "0.00";
    		$total4 = ($cakes1q1 * $price4);
    		
    		break;
    	}// close cakes type1
    
    //cakes type2	
    	switch($cakes2)
    	{
    	case "Cheese Cakes":
    		$price5 = "70.00";
    		$total5 = ($cakes2q2 * $price5);
    		
    		break;
    	
    	case "Birthday Cakes":
    		$price5 = "70.00";
    		$total5 = ($cakes2q2 * $price5);
    		
    		break;
    		
    	case "Cream Cupcakes":
    		$price5 = "36.00";
    		$total5 = ($cakes2q2 * $price5);
    		
    		break;
    		
    	case "Chocolate Banana Muffin":
    		$price5 = "36.00";
    		$total5 = ($cakes2q2 * $price5);
    		
    		break;
    		
    	case "Black Forest Cakes":
    		$price5 = "70.00";
    		$total5 = ($cakes2q2 * $price5);
    		
    		break;
    	
    	
    	default:
    		$price5 = "0.00";
    		$total5 = ($cakes2q2 * $price5);
    		
    		break;
    	}//close type 2
    	
    	//cakes type 3
    	
    	switch($cakes3)
    	{
    	case "Cheese Cakes":
    		$price6 = "70.00";
    		$total6 = ($cakes3q3 * $price6);
    		
    		break;
    	
    	case "Birthday Cakes":
    		$price6 = "70.00";
    		$total6 = ($cakes3q3 * $price6);
    		
    		break;
    		
    	case "Cream Cupcakes":
    		$price6 = "36.00";
    		$total6 = ($cakes3q3 * $price6);
    		
    		break;
    		
    	case "Chocolate Banana Muffin":
    		$price6 = "36.00";
    		$total6 = ($cakes3q3 * $price6);
    		
    		break;
    		
    	case "Black Forest Cakes":
    		$price6 = "70.00";
    		$total6 = ($cakes3q3 * $price6);
    		
    		break;
    	
    	
    	default:
    		$price6 = "0.00";
    		$total6 = ($cakes3q3 * $price6);
    		
    		break;
    	}//close type 3 and all cakes type
    	
    	$totalpay = $total1 + $total2 + $total3 + $total4 + $total5 + $total6 ;
    	
    
    
    	$insert_sql="INSERT  INTO order 
    	values('$username','$fullname','$icno','$phoneno','$address','$email','$pastry1','$pastry1q1','$pastry2','$pastry2q2','$pastry3','$pastry3q3','$cakes1','$cakes1q1','$cakes2','$cakes2q2','$cakes3','$cakes3q3''$totalpay',NOW())";
    		$result = mysql_query($insert_sql) or die ("Error In sql ".mysql_error());
    		if($result)
    		{
    			echo "<font color='white'><h1>Successfully Insert Data into database.</h1><br>";
    			echo "<font color = 'white'>Your order has been inserted to our database. Kindly Please Pay Your Booking Payment Within in 3 					
    			days.If you do not pay it we suggest that your are cancel your booking. Thank You.</font>";
    			echo "<font color='white'><a href='../main2.php'<h2>Click Here To Continue !</h2></a>";
    			}
    			else
    			{
    				echo "Error In Inserting data.";
    				}
    
    ?>
    Attached Files
    Last edited by Rabbit; Mar 16 '12, 03:15 PM. Reason: Please use code tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please use code tags when posting code.

    order is a reserved key word in SQL. Rename your table.

    Comment

    Working...