Access Tables with number prefix

When in multisite, the wpdb prefix is always the prefix required to access the tables for the current site. This includes the site ID so this should work: $wpdb->get_results($wpdb->prepare(“SELECT * FROM “.$wpdb->prefix.”options WHERE …..”)); There should be no difference at all when using multisite, just make your queries as if it were single site.

Multiple WordPress Pages

The easiest way would be to create a page template. You would assign all 50 pages to your page template, giving each page it’s own title. Any content you want to be different on each page could be put into the page itself. Anything that you want duplicated on all of the pages, keep in … Read more

sql for querying post and their category

To get a specific post in WordPress, you can use the get_post() function and get_the_category() to get the categories associated with it. You can then use the code found in this answer to dump the SQL queries used. <?php $post_ID = 7; $the_post = get_post( $post_ID ); $the_category = get_the_category( $post_ID );