mikelmao Posted August 4, 2008 Share Posted August 4, 2008 My query doesnt save into the DB.. here it is: <?php include 'connect.php'; if($_SERVER['REQUEST_METHOD'] == 'POST') { if($_POST['fname'] == "" || $_POST['lname'] == "" || $_POST['uname'] == "" || $_POST['pass'] == "" || $_POST['pass2'] == "" || $_POST['mail'] == "" || $_POST['birth'] == "") { echo "Please fill in all the fields before continuing"; echo "<meta http-equiv=Refresh content=2;url='order.php'>"; } elseif($_POST['pass'] != $_POST['pass2']) { echo "The 2 passwords do not match"; echo "<meta http-equiv=Refresh content=2;url='order.php'>"; } else { mysql_query("INSERT INTO order (fname, lname, uname, pass, mail, birth, plan, time) VALUES ('" . $_POST['fname'] . "', '" . $_POST['lname'] . "', '" . $_POST['uname'] . "', '" . $_POST['pass'] . "', '" . $_POST['mail'] . "', '" . $_POST['birth'] . "', '" . $_POST['plan'] . "', '" . $_POST['time'] . "')"); echo "Thank you for ordering at CXHosting, We will review your application within 48 Hours. You will recieve an email when your application has been aproved"; } } ?> Connect.php= <?php $con = mysql_connect('localhost','****','*****'); if (!$con) { echo "Connot connect."; } mysql_select_db('***********' ,$con); ?> it all exists.. I dont get any MYSQL Errors.... Please help.. thanks Quote Link to comment Share on other sites More sharing options...
mikelmao Posted August 4, 2008 Author Share Posted August 4, 2008 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 (fname, lname, uname, pass, mail, birth, plan, time) VALUES ('jlhkjkgjhfg'' at line 1 Thats the error Quote Link to comment Share on other sites More sharing options...
mikelmao Posted August 4, 2008 Author Share Posted August 4, 2008 anyone know how to fix this problem? :'( Quote Link to comment Share on other sites More sharing options...
elflacodepr Posted August 4, 2008 Share Posted August 4, 2008 try this: mysql_query("INSERT INTO order (fname, lname, uname, pass, mail, birth, plan, time) VALUES ('$_POST['fname']' , '$_POST['lname']' , '$_POST['uname']', '$_POST['pass']', '$_POST['mail']', '$_POST['birth']', '$_POST['plan']', '$_POST['time']"')"); Quote Link to comment Share on other sites More sharing options...
mikelmao Posted August 4, 2008 Author Share Posted August 4, 2008 nope same error :'( Quote Link to comment Share on other sites More sharing options...
revraz Posted August 5, 2008 Share Posted August 5, 2008 ORDER is a MySQL reserved word. Either change the table name or use `backticks` around it. Quote Link to comment Share on other sites More sharing options...
fenway Posted August 6, 2008 Share Posted August 6, 2008 And if that doesn't work, show us the actual error. Quote Link to comment 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.