wpdb returns null on pages
-
I’m trying to access my database through one of my pages and wpdb keeps on returning null. Here’s my code:
<?php global $wpdb; $table_name = $wpdb->prefix . "mcpd_currency"; $results = $wpdb->get_var("SELECT code FROM ".$table_name." WHERE currency='Australian Dollars'", ARRAY_A); var_dump($results); ?>
This works when I use this on my plugin files but not on a page. Does anyone know why this is?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘wpdb returns null on pages’ is closed to new replies.