• Resolved 44nato44

    (@44nato44)


    Hi,

    I am updating my customer table, which updates the table so my count should return null

    But with or without the flush command the get_var, returns a 1

    Please see code below –

    $wpdb->update(‘tbl_Battle’, array( ‘Battle_Dead’ => 1, ‘Battle_Front’ => $varfrontno ), array(‘Battle_Number’ => $varbattno, ‘Battle_Army’ => $varbattarmy ));
    $wpdb->flush();
    $Getfrontno = $wpdb->get_var(“SELECT count(Battle_ID) FROM tbl_Battle WHERE Battle_Front = 0 AND Battle_Number = 3”);

    ————

    If I run the count command in mysql then it returns null

    Is there a reason why my get_var retrieves a value which is not correct ?

    I hope one has a great idea

    Thanks

    Best Regards

    Torben

Viewing 3 replies - 1 through 3 (of 3 total)
  • Do you have error reporting turned on?

    Hello,

    global $wpdb;
    $helloworld_id = $wpdb->get_var("SELECT ID FROM wp_posts WHERE post_name = 'hello-world'");
    echo $helloworld_id;

    You can try in this way.
    Thanks.

    Thread Starter 44nato44

    (@44nato44)

    Thanks for your responses, I took the time to do a 100% verification of my logic and saw I got it wrong.

    So it has been resolved, I had to move some functions around to make this work.

    Thanks for your answers

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wpdb get_var not working’ is closed to new replies.