Solution:
Try ‘echo’ instead of ‘print_r’.
With ‘ownerID’, check this code:
$result2 = $wpdb->get_results('select siteNAME from `site_info` where ownerID=159' );
foreach($result2 as $result) {
echo $result->siteNAME;
}
OR
Without ‘ownerID’, check this code:
$result2 = $wpdb->get_results('select siteNAME from `site_info` ');
foreach($result2 as $result) {
echo $result->siteNAME;
echo "<br/>";
}
print_r() function is mainly used for printing arrays.
Hope, this may be helpful for you.