Title: Database error when posting
Last modified: August 18, 2016

---

# Database error when posting

 *  [crawfordna](https://wordpress.org/support/users/crawfordna/)
 * (@crawfordna)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/database-error-when-posting/)
 * Possible bug report…
 * Just upgraded to MySQL 5, PHP5, and WP 2.0 on an IIS 6 box. So far so good, however,
   when I try and create a new entry in WP, I must click “post” before I can click“
   save”. If I click “save”, I get this:
 * WordPress database error: [Incorrect datetime value: ” for column ‘post_date’
   at row 1]
 * Should I be able to save here? Should the save button maybe be disabled until
   the post has actually been submitted?
 * Thanks
    Nick

Viewing 10 replies - 1 through 10 (of 10 total)

 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/database-error-when-posting/#post-304813)
 * Indeed it is a bug.
 * I’ve submitted it to trac: [http://trac.wordpress.org/ticket/2175](http://trac.wordpress.org/ticket/2175)
 *  [michael_](https://wordpress.org/support/users/michael_/)
 * (@michael_)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/database-error-when-posting/#post-304912)
 * FYI:
    I am having the same error, see [http://wordpress.org/support/topic/53693](http://wordpress.org/support/topic/53693)
 * System used:
    – WP 2.0 – Windows XP – Apache 2.0.55 – PHP 5.1.1 (module) – MySQL
   5.0.17
 * Regards,
    Michael
 *  [testing_wp](https://wordpress.org/support/users/testing_wp/)
 * (@testing_wp)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/database-error-when-posting/#post-305388)
 * This thing sits deeper. Is WP 2.0 compatible with MySQL 5.x (default settings)
   at all?
    (Testing on XPSP2, IIS, PHP 5.1.1, MySQL 5.0.18) Exactly same problems
   as above, plus: Did not find any workarount to upload binaries. Insert fails:
 * WordPress database error: [Field ‘post_content_filtered’ doesn’t have a default
   value]
    INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content,
   post_title, post_excerpt, post_status, comment_status, ping_status, post_password,
   post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order,
   post_mime_type, guid) VALUES (‘1’, ‘2006-01-03 19:53:18’, ‘2006-01-03 18:53:18’,‘
   bar’, ‘foo’, ”, ‘attachment’, ‘open’, ‘open’, ”, ‘foo’, ”, ”, ‘2006-01-03 19:
   53:18’, ‘2006-01-03 18:53:18’, ‘-1136314360’, ‘0’, ‘image/jpeg’, ‘[http://localhost/wp/wp-content/uploads/2006/01/Sunset.jpg&#8217](http://localhost/wp/wp-content/uploads/2006/01/Sunset.jpg&#8217);)
 *  [mniepert](https://wordpress.org/support/users/mniepert/)
 * (@mniepert)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/database-error-when-posting/#post-305389)
 * It’s probably a compatibility issue with MySQL 5.x
 * [http://wordpress.org/support/topic/52753?replies=10](http://wordpress.org/support/topic/52753?replies=10)
   
   [http://wordpress.org/support/topic/54487?replies=6](http://wordpress.org/support/topic/54487?replies=6)
 *  [byon](https://wordpress.org/support/users/byon/)
 * (@byon)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/database-error-when-posting/#post-305410)
 * It certainly is.
 *  [oncidium](https://wordpress.org/support/users/oncidium/)
 * (@oncidium)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/database-error-when-posting/#post-305412)
 * I think I may be having a related problem, although it doesn’t seem to matter
   whether I click save or post first.
 * I posted this morning with no problem and I am trying to post again and get this
   message: [http://www.divaknitting.com/blog/wp-admin/post.php](http://www.divaknitting.com/blog/wp-admin/post.php)
   65.29.203.219 /blog/wp-admin/post.php [http://www.divaknitting.com](http://www.divaknitting.com)
   Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/
   1.5 403
 * The only thing I’ve done differently was cut and paste the text from word. I 
   used the html window since there were links etc in code form. I am trying to 
   change the timestamp to date it for monday, so I don’t know if that could be 
   the problem or not.
 *  [dannyd](https://wordpress.org/support/users/dannyd/)
 * (@dannyd)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/database-error-when-posting/#post-305422)
 * I have the same problem and have found a workaround:
 * Just check the ‘Edit Timestamp’ checkbox (you have to ‘open’ the ‘Post Timestamp:’
   option first on the right).
 * This will force a date to be set in the INSERT.
 * Cheers,
 * Danny
 *  [loydte3](https://wordpress.org/support/users/loydte3/)
 * (@loydte3)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/database-error-when-posting/#post-305436)
 * Apparently I too am having same or similar problems as delineated above. My issue
   comes into play when I click the “save and continue editing” or the “save” button
   in the “Write” section of the Admin Panel. The “Post” button works completely
   fine. Danny’s suggestion above did ameliorate the problem.
 * My site is running with PHP 5, MySQL 5, and IIS 6. Here’s the error I get:
    `
   WordPress database error: [Incorrect datetime value: '' for column 'post_date'
   at row 1] INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content,
   post_content_filtered, post_title, post_excerpt, post_status, comment_status,
   ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt,
   post_parent, menu_order, post_mime_type) VALUES ('1', '', '', 'Test', '', 'Test','','
   draft', 'open', 'closed', '', '', '', '', '', '', '0', '0', '')
 * WordPress database error: [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''
   at line 3]
    SELECT category_id FROM wp_post2cat WHERE post_id =
 * WordPress database error: [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'
   1)' at line 2]
    INSERT INTO wp_post2cat (post_id, category_id) VALUES (, 1)
 *  Warning: Cannot modify header information - headers already sent by (output 
   started at E:Websitesinterstellar-travel.comwwwrootwp-includeswp-db.php:102) 
   in E:Websitesinterstellar-travel.comwwwrootwp-adminpost.php on line 59
 * Hopefully the folks with get this version compatible with the latest version 
   of MySQL.
    v/r, Tom
 *  [coverpearl](https://wordpress.org/support/users/coverpearl/)
 * (@coverpearl)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/database-error-when-posting/#post-305459)
 * Hi everybody,
 * I had the same problem (couldn’t insert my first post ever into db) and solved
   it like this:
 * Instead of ‘$post_date’ and ‘$post_date_gmt’ I wrote **NOW()** into the insert
   query and it just works fine for me at the moment.
 * Hint: With **NOW()** you get the date and the time and in my case it actually
   did change to gmt – but I don’t know why.
 * Bye
    CoverPearl
 *  [ryanenation](https://wordpress.org/support/users/ryanenation/)
 * (@ryanenation)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/database-error-when-posting/#post-305472)
 * WordPress does not require $post_date or $post_date_gmt to be set if the status
   of the post is ‘draft’. The problem is the database doesn’t distinguish between
   post types and will not accept an empty value. Simply removing `if ( 'draft' !
   = $post_status )` from within the if statements that set the $post_date and $
   post_date_gmt variables solves the problem. After the change, regardless of the
   post status, the timestamps are created and stored.
 * The file that needs changed is functions-post.php found in the wp-includes folder.
   Hope that helps.
 * Ryan

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Database error when posting’ is closed to new replies.

## Tags

 * [datetime](https://wordpress.org/support/topic-tag/datetime/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 10 replies
 * 11 participants
 * Last reply from: [ryanenation](https://wordpress.org/support/users/ryanenation/)
 * Last activity: [20 years, 1 month ago](https://wordpress.org/support/topic/database-error-when-posting/#post-305472)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
