So I added permissions for my $mydb user to have SELECT priviledges to my WordPress database.
I then used this code to perform the JOIN:
$sql="SELECT * FROM `mydb`.`records` rec LEFT JOIN `wpdb`.`wp_users` usr ON rec.`mydb`=usr.`ID`";
$records = $mydb->get_results($sql, ARRAY_A);
Worked great!
Related Posts:
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- inserting a post from an extern php file but post content doesn’t show on wp site
- can’t delete a row from post_meta table
- Creating a search form in PHP to search a database?
- How to return number of found rows from SELECT query
- Transaction when using WP functions rather than vanilla SQL?
- Check if post of title already exists
- $wpdb->delete column values IN ARRAY()?
- How to get the list of WooCommerce product image of a certain category from database?
- How to make WordPress plugin check for database changes and then do something?
- How To Make Connection To WordPress Data Base In A Plugin?
- Changing user_nicename
- Does WordPress cache get_user_meta() results?
- How to auto login user again after change user_login
- WordPress will not operate correctly
- error importing localhost export file to server
- How to sort results from a custom database table
- How can I call a row of user specific data from a custom table added to the WP Database
- How to merge local and live databases?
- How to track a users progress through pages by inserting data into WordPress Database?
- Import 10,000 Users into WordPress WITH a specific ID for each user
- WPDB: how to get the value of a field in a custom database table
- WP database error for comments_popup_link()
- if statement on database query
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- No wp-config.php file on local install of wordpress – site still displays
- Performance issues with large website [closed]
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- register_activation_hook isn’t adding table to DB
- What SQL / WordPress queries would need a nonce?
- Different database query in function.php using mysqli
- How to generate page content from database the right way?
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- phpMyAdmin displays error when importing database
- Transferring working local PHP site to wordpress – with database (MySQL)
- Create WP_Query to search for posts by their categories or their parent/child categories
- WordPress not reflecting changed of the database
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- How can I save unique user data on my site? [closed]
- Update results, Before deleting the related category [closed]
- database sent to a JSON file
- $wpdb->insert() does not Insert record in a table
- Using custom tables for old posts
- Databases – Submitting data from inputs to database [closed]
- Not connecting to database in file with multiple MySQL connections
- Is it best to avoid using $wpdb for security issues?
- WordPress Block developer from exporting Database via PHP
- wpdb prepare insert table doesn’t work
- Should I use WordPress to skin a database website?
- How do I display offsite database info on my wordpress site?
- Creating Database Table vs. Adding MetaData to Post & User
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Most commented posts by time period (last 12h, last 24h and etc)
- Use $wpdb or other PHP script method to find/replace in WP database
- How can I add a new row in a separate database when someone registers via WordPress?
- I can’t update my data through $wpdb
- Lost in trying to create user database system
- Pull MySQL data from multiple tables and merge into 1 PHP array
- Filter results from a serialized string to use on statistics
- wordpress site – using custom database and PHP
- Use variable in SQL statement
- Why when I create a new post I found 2 record related to this post into the posts database table?
- Adding data to custom wordpress database table
- mySQL queries are executed twice on wordpress website
- phpMyAdmin error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’
- Add row to custom database Table and delete all rows older than 1 day
- select a single val though a table in wordpress
- making php value numeric
- SQL error with custom query
- What’s wrong in my PHP code? I’m using WordPress Astra Theme and I can’t insert data into my SQL
- Database SQL query error
- Please help! I have a problem with getting wordpress databas
- How to run complex query using PHP
- Error establishing a database connection (Set-up locally)
- add role on WordPress in PHP on a second database
- PHP Warning: mysqli_query(): after updating my websites php from 5.6 to 7.2
- Using wpdb to connect to a different database is not working
- Editing the term_order field
- Insert data from form to database
- Inserting other fields to existing registration form in a WordPress theme
- Front end/Database connection in WP
- SQL Query Search page
- direct query to post_meta table
- Conditional statement within WP SQL query
- How to set max users to 17.000
- Can not manually create a database ( db, user, pass ) for a plugin
- two wordpress sites, two themes, one database, same content
- Insert double entry in DB
- How to connect database table to each registered wordpress user.
- Querying multiple meta_keys in WordPress SQL query
- Let users register weight each day and save it in DB
- Custom query_posts() parameter
- How to pass username into form that sends data to database
- How to edit the default database of WordPress [closed]
- Display total count of products in orders of a specific order status
- Execute multiple PHP Snippets causes error?
- Custom form that stores data in mysql database
- Retrieve data from external database and insert back in
- Putting form result in my database
- Can’t insert into a database wordpress