Forums

Wordpress Inclusion (6 posts)

  1. Anonymous
    Unregistered
    Posted 1 year ago #

    ok I have a simple yet frustrating problem.

    I am currently coding a script which i want to do the following in:
    - Loop through an array of wp config files
    - Include the currently selected file
    - Do stuff
    - CLOSE THE SELECTED FILE/CONNECTION
    - Continue

    My code is perfect and fine, the wordpress being included isn't.

    When I include the first one in the array, it will connect fine and do the "stuff" i specify. But when it gets to the second array entry, it includes the file but continues to use the first file's connection.

    I tried mysql_close and even unsetting $wpdb but no luck, wordpress just doesn't want to be closed.

    Its so simple yet WP makes it so complex and irritating.

    If anyone can answer this I will be very greatful.

    Thanks
    J

  2. whooami
    Member
    Posted 1 year ago #

    dont close wordpress' db connection.

    use the new_link parameter when opening the second db connection.

    http://us.php.net/function.mysql-connect

  3. Anonymous
    Unregistered
    Posted 1 year ago #

    well I can't because im simply including the wordpress' config file.

    It works perfect until it tries including another file.

  4. whooami
    Member
    Posted 1 year ago #

    well youre going to have to elaborate on what you are trying to do. What you describe above isnt enough.

  5. Anonymous
    Unregistered
    Posted 1 year ago #

    ok

    I have a custom script, I include wp-config.php INTO that script (include "wp-config.php") but from an array.

    e.g.

    $array = array("wp-config.php","anotherwp-config.php");
    foreach($array as $value) {
    include $value;
    // Do stuff
    // somehow close the current wordpress connection
    }

    But as it is now, when the second config is included, the first connection is still used, not the second.

  6. whooami
    Member
    Posted 1 year ago #

    dunno cant help you, and dont understand why you are including configuration files like that. But whatever..

Topic Closed

This topic has been closed to new replies.

About this Topic