WordPress.org

Support

Support » How-To and Troubleshooting » $wpdb->get_var( ) returns every time 0?

$wpdb->get_var( ) returns every time 0?

  • Hello,
    first; Sorry for my english, I’m from germany.

    I have a problem, that I don’t really understand so far. I created a new table in the standard wordpress-database. I’m trying to check if an entry exists. If yes, do nothing, else, make a new entry. The code is the following:
    $Result = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->wp_mod_likes WHERE comment_ID = '$cmt_ID', comment_parent = '$cmt_prnt'");

    But for me, the variable $Result always is zero, even if there is an entry which matches. I tried a lot of things, but nothing worked…

    Can somebody help me?

    Very thank you all! 🙂

Viewing 1 replies (of 1 total)
  • Seems to work right now. Just erased the $wpdb-> before the table-name. Thanks.

Viewing 1 replies (of 1 total)
  • The topic ‘$wpdb->get_var( ) returns every time 0?’ is closed to new replies.
Skip to toolbar