Query multiple tables at once?

SELECT * FROM wp_posts, wp_2_posts, wp_3_posts WHERE wp_posts.post_content LIKE ‘%foo’ OR wp_2_posts.post_content LIKE ‘%foo’ OR wp_3_posts.post_content LIKE ‘%foo’; should do the trick. (Note that in Multisite, there shouldn’t be a wp_1_posts — your root site uses wp_posts etc.)

putting wp_query data into html table

Here is what is happening with your code: query_posts uses the global variable wp_query. It always overwrites that variable, which is why you should not use query_posts pretty much ever. Your first query_posts clobbers the original $wp_query data. You start the Loop The first thing you do in that loop is reset $wp_query to the … Read more

Change options table prefix only

This is actually not that hard, but you will have to excuse me for keeping it high level because this is just a stupid thing to do as all things which are security by obscurity. All you need to do is write your WPDB driver, which inherits the WPDB class. Place it in /wp-content/db.php file … Read more

How to access custom WordPress database tables

Are you sure that’s the table name? Usually on install WordPress prompts you to setup a table prefix so the default isn’t wp_. Additionally, you need to call the global $wpdb object so it’s accessible to use: global $wpdb; $user_count = $wpdb->get_var( “SELECT COUNT(*) FROM $wpdb->users” ); echo “<p>User count is {$user_count}</p>”; Finally, to prevent … Read more

Code is providing a row of data but not formatting it as table

It’s not displayed as table, because you don’t return correct HTML code. Let’s take a look at your code (I’ve put comments at end of incorrect lines): $content=”<table>”; $content .= ‘</tr><th>Week Beginning</th><th>Monday</th><th>Tuesday</th><th>Wednesday</th><th>Thursday</th><th>Friday</th><th>Saturday</th><th>Sunday</th><th>Weekly Total</th><th>Previous Week Totals</th></tr>’; // <- here you open TR with </tr>, so it’s already incorrect $results = $seconddb->get_results( ‘ SELECT * FROM seconddb_PontoonBoats_LineOne_2Log’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)