Support » Developing with WordPress » $seconddb; no longer working

  • In the middle of developing a new site for a client, it was moved to a new, cloud-based package from the same host.

    Since the move, two sections that are dependent upon pulling content from the original, non-wordpress db, are functioning.

    Nothing else has changed. I’ve confirmed with the host that “localhost” remains; otherwise that won’t provide any assistance.

    Creating a new user & pwd has not fixed the issue.

    Thoughts anyone???

    Below is the code in the functions.php file

    function seconddb() {
    global $seconddb;
    $seconddb = new wpdb(usr, pwd, db_name, localhost);
    }
    add_action(‘init’, ‘seconddb’);

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steve Stern

    (@sterndata)

    It looks like you didn’t provdie a password in that call. The last error may be due to a PHP version change from the old to the new host.

    Warning: mysql_query(): Access denied for user 'joelgood'@'localhost' (using password: NO) in /home2/joelgood/public_html/2014/wp-content/plugins/advanced-text-widget/advancedtext.php(104) : eval()'d code on line 11
    
    Warning: mysql_query(): A link to the server could not be established in /home2/joelgood/public_html/2014/wp-content/plugins/advanced-text-widget/advancedtext.php(104) : eval()'d code on line 11
    
    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home2/joelgood/public_html/2014/wp-content/plugins/advanced-text-widget/advancedtext.php(104) : eval()'d code on line 12

    The pwd was included.

    Will look into a change in php versions, thanks.

    Those errors are coming from an “advanced text widget”, not from your functions.php file. By any chance is this a plugin that lets you add PHP through a widget? I’ll bet it is.

    If I had to guess, you have added some PHP code to call mysql_xxx() functions, but your new server (which would appear to be running PHP 5.5 or 5.6) probably requires mysqli_xxx() functions.

    FYI, these days you should never use mysql_xxx() functions. The mysql extension was removed in modern versions of PHP because it was slow and had serious issues with memory leaks. I’m honestly shocked it’s still supported in WordPress.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.