danrah Posted December 10, 2006 Share Posted December 10, 2006 Why doesn't this work? Please?[code]<?php $serializeditems=addslashes($_SESSION['items']); //this field is serialized $buyername=addslashes($_POST['name']); $telephone=addslashes($_POST['telephone']); $paymentmethod=addslashes($_POST['paymentmethod']); $address=addslashes($_POST['address']); $deliverytime=addslashes($_POST['deliverytime']); $email=addslashes($_POST['email']); $extrainfo=addslashes($_POST['extrainfo']);$query="INSERT INTO buyer_details". "(order,buyer_name,buyer_phone,payment_method,address,delivery_time,email,comments) VALUES" . "('$serializeditems','$buyername','$telephone','$paymentmethod','$address','$deliverytime','$email','$extrainfo')"; ?>[/code]an SQL syntax error is produced: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,buyer_name,buyer_phone,payment_method,address,delivery_time,email,comments' Quote Link to comment https://forums.phpfreaks.com/topic/30110-sql-query-problem/ Share on other sites More sharing options...
Orio Posted December 10, 2006 Share Posted December 10, 2006 You have a few quotes that I dont understand. Try it this way:[code]$query="INSERT INTO buyer_details (order,buyer_name,buyer_phone,payment_method,address,delivery_time,email,comments) VALUES ('$serializeditems','$buyername','$telephone','$paymentmethod','$address','$deliverytime','$email','$extrainfo')";[/code]Orio. Quote Link to comment https://forums.phpfreaks.com/topic/30110-sql-query-problem/#findComment-138461 Share on other sites More sharing options...
Zane Posted December 10, 2006 Share Posted December 10, 2006 buyer details?shouldn't it buyer_detailsyou can't have a space in the name Quote Link to comment https://forums.phpfreaks.com/topic/30110-sql-query-problem/#findComment-138489 Share on other sites More sharing options...
danrah Posted December 10, 2006 Author Share Posted December 10, 2006 it was buyer_details in the query.but i have found the problem:order is a reserved word Quote Link to comment https://forums.phpfreaks.com/topic/30110-sql-query-problem/#findComment-138499 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.