Skip to:

WordPress Database Error when querying inside theme files?

  • Hello,

    What I am trying to do is get data from my wordpress database based on the current buddypress user id. This is inside member-header.php inside /wp-content/themes/mytheme/members/

    I get the error on the http://mysite.tld/members/membername page:

    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 'AND meta_key= 'facebook_uid'' at line 1]
    SELECT meta_value FROM wp_usermeta WHERE user_id = AND meta_key= ‘facebook_uid’

    I am using a very similar query in the header of my main wordpress theme files so the syntax shouldn’t be wrong.

    Any ideas on this would be greatly appreciated.

You must be logged in to reply to this topic.