Reputation: 133
I am making a website where people can learn to code by completing courses so I need a table for just one user and a table for all the user info. When creating the table just for the user (in PHP) I get this error from the mysqli_error function in PHP:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '30 ( cid int(100) not null, ' at line 1
Here is the code:
create table $rowid (
cid int(100) not null,
com TEXT not null,
page int(100) not null,
title TEXT not null
);
I have set the rowid variable to their id in the user info table. When I do it from PHPMyAdmin (but replace the rowid with something else) it works fine.
What is wrong with the SQL or PHP code?
Upvotes: 0
Views: 1078
Reputation: 624
26 is not a valid table name. "Identifiers may begin with a digit but unless quoted may not consist solely of digits. ". See https://dev.mysql.com/doc/refman/8.0/en/identifiers.html for more info on identifiers. PhpAdmin probably quotes that with backticks for you.
Upvotes: 1