Skip to:
Content
Pages
Categories
Search
Top
Bottom

query OK but get_results returns nothing !!! ?


  • grosbouff
    Participant

    @grosbouff

    $array_types = BP_Classifieds_Tree::get_types();

    function get_types() {
    global $wpdb, $bp;

    $sql="SELECT * FROM {$bp->classifieds->table_tree} WHERE type = 'type'";
    print_r($sql);
    echo'';
    print_r($wpdb->get_results( $wpdb->prepare($sql) ));
    exit;
    }

    Problem :

    the $sql printed is

    SELECT * FROM wp_bp_classifieds_tree WHERE type = ‘type’

    If I run it into phpmyadmin, it returns 5 results.

    BUT

    print_r($wpdb->get_results( $wpdb->prepare($sql) ));

    returns

    Array ( )

    ……..

    what’s wrong ??

  • The topic ‘query OK but get_results returns nothing !!! ?’ is closed to new replies.
Skip to toolbar