WordPress Database Error using $wpdb->get_results()

I am trying to run a query from my functions.php inside a shortcode

See code

function nrl_listing_page($args) {
    global $wpdb;
    $wpdb->show_errors( true );
    $properties = $wpdb->wp_nrl_properties;
    $sql = " SELECT * FROM  $roperties" ;
    $query = $wpdb->get_results($sql, ARRAY_A );

    if (is_null($results)) {
    echo "Big Fat Falure!!!!";
} else {
    echo $query;
   echo "Success!!!";
add_shortcode( 'nrl_listing_creator', 'nrl_listing_page' );

I get this error when I try to use the shortcode in a page

WordPress database error: [You have an error in your SQL syntax; check
the manual that corresponds to your MariaDB server version for the
right syntax to use near ” at line 1] SELECT * FROM

What am I doing wrong?

Read more here: WordPress Database Error using $wpdb->get_results()

Leave a Reply

Your email address will not be published. Required fields are marked *