I was trying to create a new table with the following PHP/mysql code snippet:
$query = "
CREATE TABLE IF NOT EXISTS :user (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
username CHAR(24),
summonername VARCHAR(16),
password VARCHAR(16),
region CHAR(3),
lvl INT(2) DEFAULT '0',
maxlvl INT(2),
status VARCHAR(20),
enabled INT(1) DEFAULT '1',
priority INT(1) DEFAULT '0',
note VARCHAR(150)
)
";
$query_params = array (
':user' => $user,
);
If I execute this one, I get some syntax error:
Failed: 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 ''testuser' ( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, use' at line 1
It is weird because I checked the syntax according to the official documentation (http://dev.mysql.com/doc/refman/5.1/de/create-table.html) and also some user-made examples. Also, is there a way to set the default encoding of the table to utf8 (not for every single row, but global)?
I would be happy if someone can tell me how to fix the syntax errors there,