I have the following:
$query = 'SELECT * FROM wp_pod_tbl_add_questions WHERE id LIKE '. $id;
$row = $wpdb -> get_results($query);
How do I get the columns named 'id' and 'name' from $row?
|
I have the following:
How do I get the columns named 'id' and 'name' from $row? |
|||
|
|
More info here |
|||
|
|
|
Always Try the WordPress Codex: http://codex.wordpress.org/Class_Reference/wpdb#SELECT_Generic_Results Essentially given the default syntax, the variable $row here is an object containing your results. You could alternately specify the TYPE of result (numeric array, associative array). Assuming just one result, then $row->id and $row->name should give you the information. If you get back more than one result, you'd want to loop over the entries in the object. If you are expecting just one row back, then try using $wpdb->get_row http://codex.wordpress.org/Class_Reference/wpdb#SELECT_a_Row |
|||
|
|