Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.