loop threw $wpdb->get_results code example
Example: wpdb get results foreach
$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;}