mysql - How to query database in WordPress and loop through results -


i've been used making simple pdo queries mysql this:

$query = $db->prepare("select * `my_table` order `rank`"); $query->execute(); $numrows = $query->rowcount(); while($row = $query->fetch()) { $thiscolumn = $row['value']; } 

but want same using wordpress (not 1 of wordpress's own tables, 1 of own). simplest way of translating query?

global $wpdb; $query = "select * `my_table` order `rank`"; $result = $wpdb->get_results($query); foreach ($result $instance) { echo $instance->value; } 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -