#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax
11,905
Solution 1
You're using PHP in a place that expects plain SQL (note that the OP stated "I used sql tab in phpMyAdmin"). Cut it down to:
create table `query_log` (
query varchar(255),
time timestamp,
elapsed float(2),
results int,
key query_key(query)
)
And @Aurelio is right, there's no length parameter to timestamp.
Solution 2
The first error I see is that timestamp
does not have a lenght. So this line:
time timestamp(14),
should be like this:
time timestamp,
Author by
Remus Grigorescu
Updated on June 05, 2022Comments
-
Remus Grigorescu almost 2 years
I want to create a table using the following script:
mysql_query("create table `".$mysql_table_prefix."query_log` ( query varchar(255), time timestamp(14), elapsed float(2), results int, key query_key(query) )");
It gives me this error:
#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 'mysql_query("create table `".$mysql_table_prefix."query_log` ( query varchar(25' at line 1
EDIT: I used sql tab in phpMyAdmin
What can I do?