Title: Database used in PHP code is outdated in PHPMyAdmin
Last modified: February 8, 2018

---

# Database used in PHP code is outdated in PHPMyAdmin

 *  [jeffmcml](https://wordpress.org/support/users/jeffmcml/)
 * (@jeffmcml)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/database-used-in-php-code-is-outdated-in-phpmyadmin/)
 * Hope this is the right forum – I didn’t find one for databases.
 * I have an intermittent problem. I have PHP code that checks a member database
   for expiration dates and sends a reminder when the expiration date has arrived.
   This code has been working for several years but now fails intermittently. For
   example, of two member records with the same expiration date of 12/30/2017, one
   is found and one is not.
 * The code which checks the ‘dateexpire’ column:
 *     ```
               $members = $wpdb->get_col( "
                   SELECT um.user_id
                   FROM {$wpdb->usermeta} um
                   WHERE um.meta_key = 'dateexpire'
                   AND DATE(um.meta_value) = (DATE_ADD(curdate(), INTERVAL +0 DAY))
               ");
       ```
   
 * I inherited this code from a previous webmaster and I admit I don’t fully understand
   what it’s doing. It seems to be referencing the usermeta table, however the wp_users
   table with the dateexpire column is in a custom database, separate from the default
   wp database. When I look at the database in PHPMyAdmin to check the values, I
   log in with the same username and password used by the PHP code. But when I look
   at the wp_users table, it is way out of date – the last update was in 2014 and
   I know that many updates have been made since then. I can export the same table
   from my PHP page and I get the current values.
 * Is there a hidden version of MySQL databases?
    -  This topic was modified 8 years, 3 months ago by [jeffmcml](https://wordpress.org/support/users/jeffmcml/).
    -  This topic was modified 8 years, 3 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/database-used-in-php-code-is-outdated-in-phpmyadmin/#post-9953553)
 * Nothing hidden, at least not by default. So, same user and password. Are you 
   sure it’s the same DB defined as ‘DB_NAME’ and host defined as ‘DB_HOST’? Are
   you looking at the right WP installation? With redirects, the root installation
   is not necessarily the one being served. If you were to make a new post, will
   it appear at the end of the posts table?
 * Even if that all checks out, it’s possible for custom code to override where 
   data is queried from. User table queries can be intercepted and sent elsewhere.
   There’s a number of ways to do this, so it’s not simple to find such custom code.
   It should be in a custom theme or plugin, but not everyone follows good practice,
   so the code could be anywhere.
 * There are even several ways to connect to other DBs, so searching for telltale
   code might not be very fruitful either. If the snippet you posted is successfully
   getting users from an external DB, then the custom code is swapping different
   connection objects somewhere, because `$wpdb` is normally the WP global DB connection
   object. If it’s connecting elsewhere, the original connection object is likely
   saved as a different object and gets swapped back in after the user query. Searching
   for custom code that does this will help you find out where to start debugging,
   or at least get you to the right DB.

Viewing 1 replies (of 1 total)

The topic ‘Database used in PHP code is outdated in PHPMyAdmin’ is closed to new
replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/database-used-in-php-code-is-outdated-in-phpmyadmin/#post-9953553)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
