Rother2005 Posted January 15, 2007 Share Posted January 15, 2007 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(Username,Product) VALUES ('v','b')' at line 1[code]<?phpinclude('connect1.inc');?><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Booze Cruise Reg</title></head><body><?php if(!$_POST['register']){echo'<p align="center"><strong>Member Registration</strong></p><form name="form1" method="POST" action=""><p align="center">Username: <input type="text" name="username" maxlength="10"></p><p align="center">Product: <input type="text" name="product" maxlength="20"></p><p align="center"><input type="submit" name="register" value="Enter Order"></p></form>';} //27else{//checks if user has input textif(isset($_POST['username']) && !empty($_POST['username'])){ // valid $username = $_POST['username'];}else{ // not valid die ("No Username Input");}if(isset($_POST['product']) && !empty($_POST['product'])){ // valid $product = $_POST['product'];}else{ // not valid die ("No Product Input");}$sql = "INSERT INTO order(Username,Product)VALUES ('$username','$product')";mysql_query($sql) or die(mysql_error());echo ("<meta http-equiv=\"Refresh\" content=\"2; URL=members.php\"/>Thank You! Your order has been placed");}?></body></html>[/code]any help?? Link to comment https://forums.phpfreaks.com/topic/34315-sql-syntax-right-syntax-to-use-near-orderusernameproduct-values-vb/ Share on other sites More sharing options...
effigy Posted January 15, 2007 Share Posted January 15, 2007 ORDER is a keyword; try using `order` (those are backticks--shift tilde). Link to comment https://forums.phpfreaks.com/topic/34315-sql-syntax-right-syntax-to-use-near-orderusernameproduct-values-vb/#findComment-161416 Share on other sites More sharing options...
Rother2005 Posted January 15, 2007 Author Share Posted January 15, 2007 nope im afraid that didnt work :(right syntax to use near ''order'(Username,Product) VALUES ('sds','sdssds')' at line 1could it be that the db im entering the data into goes:order - int - 10 /auto incresemember - varchar - 10product - varchar - 20date - varchar - 255 Link to comment https://forums.phpfreaks.com/topic/34315-sql-syntax-right-syntax-to-use-near-orderusernameproduct-values-vb/#findComment-161418 Share on other sites More sharing options...
Rother2005 Posted January 15, 2007 Author Share Posted January 15, 2007 well i just changed all fields to varchar so it cnt be that Link to comment https://forums.phpfreaks.com/topic/34315-sql-syntax-right-syntax-to-use-near-orderusernameproduct-values-vb/#findComment-161419 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.