I am using wordpress and I’ve created a new table in the wordpress database.
I have then created template and I am adding custome php code in there but wrapped in wordpress header and footer.
My question is, how can I query my new table, as wordpress already does the database connection etc..
Thanks
In the WordPress documentation there is a section “Run any Query on the Database” that suggest to use:
Where
query
is your SQL query you want to execute.Please be sure to protect your queries against SQL injection to avoid these kind of things:
Use the $wpdb class reference.