0

The best information I can get is

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 'desc VARCHAR (1000), postdate DATETIME DEFAULT CURRENT_TIMESTAMP)' at line 1

about my query

$wpdb->query("CREATE TABLE jobs (id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, title VARCHAR (50), desc VARCHAR (1000), postdate DATETIME DEFAULT CURRENT_TIMESTAMP) $charset_collate")

What is the error? I know it's probably obvious, so forgive me (I'm a n00b). Regarding the postdate column, I was taking the syntax straight from the answer on mysql automatically store record creation timestamp.

1
  • desc is a reserved word. The error in the error message is nearly always at, or immediately to the left of, the first word in the error message. Commented Jul 21, 2015 at 16:25

1 Answer 1

1

desc is a reserved keyword in MySQL and needs to be escaped by backticks.

... , `desc` VARCHAR (1000) ...
Sign up to request clarification or add additional context in comments.

2 Comments

or... better idea... not used as a table/column identifier
I could've easily put in an answer for this, and is the 2nd one in 24 hours. why don't you just mark these as duplicates?