Bug: DB Error – Table wp_users does not exist
-
Thank you, Bastien, for providing this plugin.
I find it quite useful, but unfortunately there are issues that keep me from actually using it.The main issue I have is a consistent database error.
I hope I can help pointing you in the right direction, so that you may be able to fix it.
Since I first tried My shared widgets with WP 4.3.x, I have consistently had a DB error which did not change after updating to WP 4.4.x.
The error message originally read:
WordPress Database Error Table ‘wp_users’ doesn’t exist for query SELECT ‘user_nicename’ FROM wp_users WHERE ID =
The error is in the prefix of the table name wp_users, which should read dp_users.
When I looked at the code, I found that wp_users is hard-coded.
I changed your line of code
$a_req = 'SELECT ′user_nicename′ FROM wp_users WHERE ID = ' . $widget->post_author;
to read:$usr_nice = $wpdb->base_prefix . 'users'; $a_req = 'SELECT ′user_nicename′ FROM ' . $usr_nice . ' WHERE ID = ' . $widget->post_author;
This had the nice effect that the original DB error was gone, but a new one showed up:
You have an error in your SQL syntax for the query SELECT ‘user_nicename’ FROM dp_users WHERE ID =
I checked the syntax in phpMyAdmin and found that the SQL syntax itself is ok, but $widget->post_author turns out empty.
This is where I got stuck. I hope you can find the error from here on, for I was not able to trace it back any further.
I’d appreciate any help you can give.
- The topic ‘Bug: DB Error – Table wp_users does not exist’ is closed to new replies.