What about replacing DESCTIPTION
the DESCRIPTION
inside $query
?
Edit
Just out of curiosity, I created a table called mytable
and copied your code into a PHP script.
Everything worked fine here, and the rows were inserted, except that the associated parameter was CURDATE()
not executed properly, and the cell ENTRYDATE
was assigned 0000-00-00
.
, , script?
error_reporting(E_ALL);
?
, script ?
:
error_reporting(E_ALL);
try {
$query = "INSERT INTO mytable (NAME, DESCRIPTION, ENTRYDATE) VALUES (?, ?, CURDATE())";
$stmt = $conn->prepare($query);
$name= 'something';
$desc = 'something';
$stmt->bind_param("ss", $name, $desc);
$stmt->execute();
if ($conn->affected_rows < 1) {
throw new Exception('Nothing was inserted!');
}
$stmt->close();
$conn->close();
}
catch(Exception $e) {
print $e->getMessage();
}