我已經更新後,我的WordPress安裝到3.9,我不斷收到這些錯誤:錯誤在WordPress插件後升級到3.9
Warning: mysql_query(): Access denied for user 'www-data'@'localhost' (using password: NO) in /home/sites/wordpress/site/wp-content/plugins/crm/main.php on line 20
Warning: mysql_query(): A link to the server could not be established in /home/sites/wordpress/site/wp-content/plugins/crm/main.php on line 20
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in /home/sites/wordpress/site/wp-content/plugins/crm/main.php on line 21
我不能完全弄清楚什麼是錯的。下面是工作前的3.9代碼:
<?php
session_start();
/**
* Plugin Name: CRM
* Description:
* Version:
* Author:
*
*/
add_action('admin_menu', 'menu');
function menu() {
add_menu_page('CRM', 'CRM', 3,'form', 'form');
}
function form() {
global $wpdb,$current_user,$user_ID;
echo "<h3>CRM</h3>";
$count = mysql_query("SELECT COUNT(id) FROM user_form_data");
$nume2 = mysql_fetch_row($count);
$nume = $nume2[0];
我剪掉剩下的,正如似乎相關的錯誤:)
解決方案並不:
發現了它。
錯誤發生在3.9升級。
http://make.wordpress.org/core/2014/04/07/mysql-in-wordpress-3-9/
「以WordPress的3.9,我們增加了一個額外的層,以WPDB,導致它切換到使用的mysqli PHP庫,使用PHP 5.5或更高。
當對於插件開發者,此裝置您絕對不應該再使用PHP的mysql _ *()函數 - 您可以使用等效的WPDB函數。「
你看過這些錯誤消息?代碼沒有問題,WordPress無法連接到數據庫。在配置中檢查憑據。 –
檢查了配置,並試圖用憑證輸入mysql。 沒有錯,那裏,似乎,因爲我成功登錄。 – oles