Support » Fixing WordPress » 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)

    (@podz)

    Support Maven

    Indeed it is a bug.

    I’ve submitted it to trac: http://trac.wordpress.org/ticket/2175

    FYI:
    I am having the same error, see 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

    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’)

    It certainly is.

    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 65.29.203.219 /blog/wp-admin/post.php 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.

    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

    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

    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

    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.