Skip to:
Content
Pages
Categories
Search
Top
Bottom

query OK but get_results returns nothing !!! ?

  • Avatar of Grosbouff
    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 ??

You must be logged in to reply to this topic.