Jump to content

error, insert query failed


buzzby

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/126259-error-insert-query-failed/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.