This is really bugging me now. Been trying to figure out the problem for hours and what hair i had left is now to torn out! hehe
All i want is this basic Insert code to work. I've done this many times before and it has worked fine. So not sure what is causing it to crap out. No doubt something obvious I am missing.
My code:
$conn = mysql_connect("$location","$username","$password");
mysql_select_db($database,$conn) or die ("Could not open database");
$sql = "INSERT INTO companies
(compname,
createdate,
createtime,
address1,
address2,
address3,
town,
county,
postcode,
landline,
mobile,
fax,
contactname,
email,
web,
tacking,
finishing,
insulating,
plastering,
supplier,
references,
traveldist,
contractor,
subcontractor,
camefrom,
desc,
emailkey)
VALUES (
'$_POST[compname]',
'$createdate',
'$createtime',
'$_POST[address1]',
'$_POST[address2]',
'$_POST[address3]',
'$_POST[town]',
'$_POST[county]',
'$_POST[postcode]',
'$_POST[landline]',
'$_POST[mobile]',
'$_POST[fax]',
'$_POST[contactname]',
'$_POST[email]',
'$_POST[web]',
'$_POST[tacking]',
'$_POST[finishing]',
'$_POST[insulating]',
'$_POST[plastering]',
'$_POST[supplier]',
'$_POST[references]',
'$_POST[traveldist]',
'$_POST[contractor]',
'$_POST[contractor]',
'$_POST[subcontractor]',
'$_POST[camefrom]',
'$_POST[desc]',
'$emailkey')";
$result2 = mysql_query($sql, $conn) or die(mysql_error());
The response:
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 'references, traveldist, contractor, subcontractor, ' at line 23
I'd appreciate any help.
Cheers
Marc