SQL error (Build Your Own Database Driven Web Site Using PHP & MySQL)

@TechnoBear Now I have a separate issue with the MySQL coding, specifically the area regarding the creation of the table. When I type into the mysql> prompt:

mysql> create table joke (
    -> id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    -> joketext TEXT,
    -> jokedate DATA NOT NULL
    -> ) DEFAULT CHARACTER SET utf8;

It gives me the error:

   ERROR 1064 (42000): 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 'DATA NOT NULL'

I have no idea why jokedate could be causing trouble.

@TechnoBear It might be that DATA is no longer an acceptable entry for the type. However, this does not seem likely, albeit the word DATA being a tad generic. If this is the case, it might be possible to replace DATA with STRING (if that is the correct syntax for string), however I don’t know how that would interface with the tutorial in terms of replacing DATA with STRING every time I see it.

Unfortunately, that’s not my area of expertise. I’ll move the new question to the Databases forum, where hopefully somebody else will be able to help.

@TechnoBear OK, thank you.

I assume that from the name of the field the type of data should be DATE.

If my memory serves me well, there is not DATA type in MySQL

@molona Thank you. That worked correctly.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.