• I’m getting the following errors several times every time I save a post:

    [12-Feb-2011 06:23:33] 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 1 for query select post_content from wp_posts where id= made by do_action_ref_array, call_user_func_array, do_all_pings, do_trackbacks, apply_filters, call_user_func_array, tfe_put_image

    Possible explanation:

    The function tfe_put_image() uses $wp_query->post->ID to determine the post ID and this seems not to be working. My understanding is that within “the loop”, the post ID can either be determined by the_ID() function or by declaring $post global and using $post->ID.

    Somehow, thumbnails still show up, but making this query seems unnecessary when has_post_thumbnail() is available, so tfe_put_image() could possibly be rewritten to perform better as well as run correct SQL.

Viewing 1 replies (of 1 total)
  • Thread Starter Gal Baras

    (@galbaras)

    I’ve tested my own theory by changing the code, but that didn’t help.

    For some reason, tfe_put_image() gets a blank post ID, even though it’s called as a filter of ‘the_excerpt’ and ‘the_excerpt_RSS’.

    Any ideas how to debug this?

Viewing 1 replies (of 1 total)
  • The topic ‘MySQL syntax error – incorrect post ID determination?’ is closed to new replies.