Can’t access to a custom table from PHP code
-
I created a new table on the wordpress database called my_table, but I cannot reach it from PHP code.
<?php $my_records = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->my_table"); echo "<p>Records count is {$my_records}</p>"; ?>
This is not working, but if I change my_table with another wordpress table like “users” for example, the PHP code works.
What am I doing worng? Is it something I have to set to make my custom table visible through the $wpdb?
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Can’t access to a custom table from PHP code’ is closed to new replies.