This should be fairly simple. I've crafted an SQL query that dumps all matching database table names to an array. I want to print them out, yet for some reason I cannot. Please help!
Database tables are named: example_1, example_2, etc.
My code:
Doing a print_r($results) shows that all the table names were successfully retrieved.
Example output:
So then I tried:
But no luck. How can I iterate through
to print out each table name? Is there something like
I could use to retrieve the values?
Database tables are named: example_1, example_2, etc.
My code:
Code:
$sql = "SHOW TABLES LIKE 'example_%'";
$results = $wpdb->get_results($sql);
Doing a print_r($results) shows that all the table names were successfully retrieved.
Example output:
Code:
Array ( [0] => stdClass Object ( [Tables_in_wordpress (example_%)] => example_1 ) [1] => stdClass Object ( [Tables_in_wordpress (example_%)] => example_2 ) )
So then I tried:
Code:
foreach($results as $res) {
echo $res;
}
But no luck. How can I iterate through
Code:
$results
Code:
$results[0].value