I have been looking around and trying different things for a while and no luck.
Scenario: I have WordPress/BuddyPress and I added in a few new tables to the database through phpMyAdmin. I cannot run a successful query to them, yet I can to all the original tables. I have tried many things, this is my most recent try, still not working:
$b1_exc = $wpdb->get_results( $wpdb->prepare("SELECT * FROM memberbadge
WHERE 1") );
I would really appreciate a solution to add custom tables and be able to query them.
Thank you in advance!
It's probably a prefix problem. Try:
If you really need a
WHERE
clause and the variable comes from user input, then useprepare
.