$results=$wpdb->get_results("SELECT * FROM your_table_name WHERE id LIKE' . $id . ';"); foreach($results as $key => $row) { // each column in your row will be accessible like this $my_column = $row->column_name;}
$records=$wpdb->query("SELECT * FROM $wpdb->posts WHERE post_type = 'elements' AND post_status = 'publish'"); while($data=$records->fetch_assoc()) { print_r($data); } }