$wpdb->update prefixes database name to table when executing query

by Mafuyu-Chama   Last Updated May 16, 2019 05:08 AM

I run into a problem I can't seem to fix. I went back and forth and even used $wpdb->prepare() and $wpdb->query() functions, nothing helps.

$table_prefix."users" returns wp_2qttgdv7ac_2_users (slightly changed in post for security purposes). Yes, I've tried $wpdb->prefix as well. Same result.

$wpdb->update($table_prefix."users", array('user_email' => $fetch_data['new_email']), array('user_login' => $fetch_data['username']))

This was not working, but on running...

var_dump( $wpdb->last_error)

I get the error:

string(59) "Table 'A41K421094D3615.wp_2qttgdv7ac_2_users' doesn't exist"

Here A41K421094D3615 is the database name. I am running in a multisite environment. However, accessing custom tables does not add database name in front of the table. How can I get it to stop adding it? Or at least make it honor the table. Usually database_name.table_name should work, right? However, it's returning that it does not exist. Any suggestions?

Related Questions

Updated April 08, 2018 14:08 PM

Updated October 13, 2017 06:08 AM

Updated December 22, 2017 07:08 AM

Updated March 13, 2017 06:08 AM

Updated November 12, 2018 14:08 PM