check if table is empty
-
Hi.
I want to check if table is empty and then I want to insert some initial data. According to https://www.mail-archive.com/[email protected]/msg19151.html the most efficient way to check if table is empty is this:
$wpdb->get_results("SELECT (SELECT id FROM $table LIMIT 1) IS NOT NULL AS x");
It gives me output:print_r($temp); Array ( [0] => stdClass Object ( [x] => 1 ) ) 1
How can I check if array element [‘x’] == 1 from php condition?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘check if table is empty’ is closed to new replies.