I have used this exact code having a slight modification from the values in another script also it labored all right, but this time around it's giving me errors. This is actually the line:

$result = mysql_query("INSERT INTO contacts (name, email, telephone, companyname, postcode, message, date) VALUES('" . $name . "', '" . $userEmail . "', '" . $telephone . "', '" . $companyName . "', '" . $message . "', '" . $date . "'") or die (mysql_error());

I have attempted echo-ing out all the variables with this particular:

<p>Name: <?php echo $name; ?>, <br />Email: <?php echo $userEmail; ?>, <br />Telephone: <?php echo $telephone; ?>, <br />Company name: <?php echo $companyName; ?>, <br />Message: <?php echo $message; ?>, <br />Date: <?php echo $date; ?>, <br /></p>

Which shows all of them fine once the form is posted. However, after i consider adding these to a database it flicks out and states this:

You possess an error inside your SQL syntax look into the manual that matches your MySQL server version for the best syntax to make use of near '' at line 1

I am presuming I am either missing something simple, I have designed a typo somewhere (although I have re-typed it to make sure it had not been that).

Here's the way in which my database is placed-up:

database set-up Any ideas?


UPDATE

I added the missing ) towards the query which eliminated the very first error, however I am getting this error after i submit it:

Column count does not match value count at row 1


FIXED

I had been missing the $postcode variable. Doh!

You're missing a ) in the finish individuals query, for that VALUES().

$result = mysql_query("INSERT INTO contacts (name, email, telephone, companyname, postcode, message, date) VALUES('" . $name . "', '" . $userEmail . "', '" . $telephone . "', '" . $companyName . "', '" . $message . "', '" . $date . "')") or die (mysql_error());

You declare yet another area than surrender VALUES. This can be the one thing with column count.