buzzby Posted September 29, 2008 Share Posted September 29, 2008 i was wondering if any of you can help me with this. i am getting the error message when inserting into the database. my code is here: $dbhost = 'localhost'; $dbuser = '***'; $dbpass = '***'; $dbname = 'formresults'; $connection = mysql_connect($dbhost, $dbpass, $dbuser) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $query = "INSERT INTO formflymetothemoon (name, parent_name, age, email, phone, address, postcode, newsletter, otherCompanies) VALUES ('$name', '$parentname', '$age', '$email', '$phone', '$address', '$pcode', '$newsletter', '$other_products')"; mysql_query($query) or die('Error, insert query failed'); i was getting the password issues but now thats fixed and am now getting the ERROR, INSERT QUEREY FAILED message. can you tell me what is wrong with this? my form action is this: <form id="form1" name="form1" method="post" action="promo.php"> my form elements is here: <input name="name" type="text" size="50" maxlength="255" /> <input name="parentname" type="text" size="50" maxlength="255" /> <input name="age" type="text" size="50" maxlength="255" /> <input name="email" type="text" size="50" maxlength="255" /> <input name="phone" type="text" size="50" maxlength="255" /> <input name="address" type="text" size="50" maxlength="255" /> <input name="pcode" type="text" size="50" maxlength="255" /> <input name="newsletter" type="checkbox" value="yes" id="newsletter"/> <input name="other_products" type="checkbox" value="yes" id="other_products" /> <input name="Submit" type="submit" value="Enter Competition" /> </form> any help on this will be really great Quote Link to comment https://forums.phpfreaks.com/topic/126259-error-insert-query-failed/ Share on other sites More sharing options...
nutstretch Posted September 29, 2008 Share Posted September 29, 2008 I use die(mysql_error()); to tell me what the prob is. Quote Link to comment https://forums.phpfreaks.com/topic/126259-error-insert-query-failed/#findComment-652892 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.