Hello everyone, I am learning php and mysql, and coding with brackets on a local server with XAMPP. So far everything was working, but INSERT INTO seems to make my web page froze with the code HTTP error 500. This usually happens when I miss a “;” but here everything seems to be fine.
Everything is correct (customers, first_name and last_name are correct and have been used with lines of code that works) so I don’t know what is causing it. Maybe someone can help me ?
Here’s the code (I deleted the php tags at the end and start because I couldn’t post otherwise) :
PHP:
“`
try {
$database = new PDO(‘mysql:host=localhost;dbname=store’,’root’,”, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}
catch(Exception $e)
{
die(‘Error: ‘.$e->getMessage());
}
$database->query(“INSERT INTO customers(first_name, last_name) VALUES (‘Clark’, ‘Kent’)”);