Reputation: 1
Can anyone confirm, that when logged into a wordpress website the global $wpdb doesnt work in own template scripts.
First i run into some problems after upgrading to php 5.5 (from 5.3) The website was running, but when logging into the wordpress i got those messages Access denied for user 'root'@'localhost' (using password: NO) then after adding root in mysql
Access denied for user 'apache'@'localhost' (using password: NO) after adding apache i got no database selected. But only when i am logged in the wordpress website
Whats going wrong here, got it now working by bypassing global $wpdb but thats not the way i want it
Upvotes: 0
Views: 543
Reputation: 50
Its because ur template scripts using mysql.
When wordpress detect php 5.5 its uses mysqli extension.
WordPress 3.9 now uses the MySQLi Improved extension for sites running PHP 5.5. Any plugins that made direct calls to mysql_* functions will experience some problems on these sites. For more information, see the notes on the core development blog.
http://make.wordpress.org/core/2014/04/07/mysql-in-wordpress-3-9/
Solution :
You have to change mysql_query to $wpdb->query or $wpdb->get_results
check code here http://codex.wordpress.org/Class_Reference/wpdb
Upvotes: 0