Reputation: 5
Creating a search engine for my website with the help of Sphider
but when creating the MySQL database tables the following error message showed
Error SQL query:
create table query_log (
query varchar(255),
time timestamp(14),
elapsed float(2),
results int)
MySQL said: Documentation
#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 '(14), elapsed float(2), results int)' at line 3
Upvotes: 0
Views: 4555
Reputation: 361
The problem lies with the number following your timestamp declaration. MySQL documentation says of the timestamp type:
the display width is fixed at 19 characters, and the format is 'YYYY-MM-DD HH:MM:SS'.
So, your code can be fixed by making the following modification:
create table query_log (
query varchar(255),
time timestamp,
elapsed float(2),
results int
)
As far as the number "14" goes, it's unclear where you were going with that. Does the project you are working on require that a timestamp of a specific length? If so, it might be best to use another data type, or to convert the timestamp to the desired format after it is pulled from the database.
I am new on StackExchange, so I hope that I've adequately answered the question. Please let me know if I can help with anything else!
Upvotes: 6