Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax

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?

like image 282
Remus Grigorescu Avatar asked Jan 23 '26 23:01

Remus Grigorescu


1 Answers

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,
like image 166
Aurelio De Rosa Avatar answered Jan 25 '26 12:01

Aurelio De Rosa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!