Hi guys.
Can you help at all with this? A bit baffled.
Also, re. pdo: how do you specify table name (as opposed to dbname)? I have put my table name following INSERT INTO. Is this correct? This is not as intuitive as mysql...
Many thanks in advance.
Ed
Quote:
#1064 - 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 ':name,:oilpostcode,:email,:phonenumber,:comments, :maillist)' at line 1. |
Also, re. pdo: how do you specify table name (as opposed to dbname)? I have put my table name following INSERT INTO. Is this correct? This is not as intuitive as mysql...
PHP Code:
<?php
$dbtype = ""; $dbhost = ""; $dbname = ""; $dbuser = ""; $dbpass = "";
$conn = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);
$name = 'name';
$oilpostcode = 'oilpostcode';
$email = 'email';
$phonenumber = 'phonenumber';
$comments = 'comments';
$maillist = 'maillist';
$sql = "INSERT INTO offmainsgas (name,oilpostcode,email,phonenumber,comments,maillist) VALUES (:name,:oilpostcode,:email,:phonenumber,:comments,:maillist)";
$q = $conn->prepare($sql);
$q->execute(array(':name'=>$name,
':oilpostcode'=>$oilpostcode,
':email'=>$email,
':phonenumber'=>$phonenumber,
'comments'=>$comments,
'maillist'=>$maillist));
if($result){
$url = 'successful_form_submission.html';
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
}
else {
echo "ERROR";
}
?>
Many thanks in advance.
Ed