Hi,
I am about to blow my brains out. Im sure you've been there!
I am trying to create a table in my MySQL database and getting this error -> SQLSTATE[42000]: Syntax error or access violation: 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 ') ENGINE = MyISAM' at line 5
here is my code for it:
try {
$userTable = 'u'.$userID;
/*** set the error mode ***/
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "CREATE TABLE `".$userTable."` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`my_themes` INT NOT NULL,
`selected_theme` INT NOT NULL,
) ENGINE = MyISAM;";
/*** our sql query ***/
$done = $conn->prepare($sql);
$done->execute();
} catch(Exception $e) {
echo '<h4>'.$e->getMessage().'</h4>';
}
I have tried everything I could think of, however I am at a mind blank of what else to try.
Does anyone have any ideas on why this code wouldn't work?
Thanks for saving a life :) :)