<?php
try {
$DBH = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$sql = $DBH->exec("
CREATE TABLE `store_config` (
store_name varchar(30),
last_update date)
");
} catch (PDOException $e) {
echo "Could not connect to database.";
$DBH = null;
}
?>
The PDOException is not thrown, there is probably an SQL error but I don't know how to retrieve that error and when I check the database with phpMyAdmin there are no tables created. What did I do wrong?
Thanks for reading.
EDIT: When I executed the same SQL code directly into phpMyAdmin it gave permission denied error...
1142 - CREATE command denied to user '$user'@'$my_ip' for table 'store_config'
I am confused because when I created the user with the web hosts web form it didn't give me options to grant any permissions but only to make this user the database owner - is that what I have to do?
EDIT:
I gave my user account 'DBO access' and it works now (the table is created).
Thanks for your comments.