Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Issue is with changes in wordpress. They have added $wpdb which will be used to access the mysql, instead of mysql_query.

    I did the following steps to migrate:

    find . -type f -exec sed -i 's/<?php/<?php global $wpdb;/g' {} +
     find . -type f -exec sed -i 's/mysql_query("SELECT/$wpdb->get_results("SELECT/g' {} +
     find . -type f -exec sed -i 's/mysql_query/$wpdb->query/g' {} +
     find . -type f -exec sed -i 's/mysql_num_rows/$wpdb->num_rows;\/\//g' {} +

    For mysql_fetch_array we need to take each function, change it using $wpdb->get_results and the use foreach instead of while.
    Also, add a param ARRAY_A to $wpdb->get_results to create an array instead of object access notation.

    Same issue being faced.

    wp-config.php has user as wordpress

    define('DB_NAME', 'wordpress');
    define('DB_USER', 'wordpress');
    define('DB_PASSWORD', 'password');

    However after activating the plugin and clicking on menu from admin I get
    Access denied for user 'root'@'localhost' (using password: NO)

    Why is it taking or where is it picking up root from ?

    PHP version 5.5.9
    Wordpress version 4.2.2
    MySQL version 5.5.38

Viewing 2 replies - 1 through 2 (of 2 total)