Hi I inserted a lot of stuff into a mysql databse.
But now I get an error in the prepare statement. I see Database prepare error. What am I doing wrong?
This is my Code:
$sql = "INSERT INTO
Contact (IP,To,Name,Email,Subject,Text)
VALUES
( ?, ?, ?, ?, ?, ? )
";
if (!$stmt = $db->prepare($sql)) {
echo 'Database prepare error';
exit;
}
$stmt->bind_param('ssssss', $ip_contact, $to_contact, $name_contact, $email_contact, $subject_contact, $text_contact);
if (!$stmt->execute()) {
echo 'Database execute error';
exit;
}
$stmt->close();
My SQL table looks like this:
Contact:
- ID int(11) auto_increment primary key
- IP varchar(15)
- To varchar(5)
- Name varchar(20)
- Email varchar(20)
- Subject varchar(20)
- Text varchar(600)