mitch95
2/4/2016 - 3:37 PM

Simple MySQL Query

Simple MySQL Query

global $wpdb; // DB Connection
$sql  = "SELECT * FROM table";
$rows = $wpdb->get_results( $sql, ARRAY_A ); // Do query & return associative array

foreach ( $rows as $row ) 
{
    print($row['id']);
}