I have a custom Wordpress table with the following contents:
account_info
id | account_id | wp_title | wp_url
1 | 12345 | website | website.com
What is the best (or fastest) way to get the results?
Option 1:
global $wpdb;
$sql = "SELECT id, wp_title. wp_name FROM account_info";
$results = $wpdb->get_results($sql);
if(!empty($results)) {
foreach($results as $r) {
$id = $r->id;
$wp_title = $r->wp_title;
$wp_name = $r->wp_name;
}
}
Option 2:
$id = $wpdb->get_var("SELECT id FROM account_info");
$wp_title = $wpdb->get_var("SELECT wp_title FROM account_info");
$wp_name = $wpdb->get_var("SELECT wp_name FROM account_info");