WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. pivke
    Member
    Posted 1 year ago #

    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! :-)

  2. pivke
    Member
    Posted 1 year ago #

    Seems to work right now. Just erased the $wpdb-> before the table-name. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags