• Scenario:

    1. Plugin A creates a new wpdb object to access a second database, using the following line within a PHP function:
    $lwpdb = new wpdb( $user, $pass, $db, $host );

    2. Plugin B attempts to reference the wordpress database via the wpdb object created by wordpress, using these lines within a function:
    global $wpdb;
    $sql = "select * from $mi_table_name";
    $results = $wpdb->get_results( $sql, ARRAY_A );

    3. Then the fun begins. Plugin B’s query gets run against the database referenced by Plugin A. I know that this is happening by the error message, which clearly states that the query is failing due to lack of select privileges on Plugin A’s database.

    This has to be either a bug or a failure to properly document the behavior of the wpdb object.

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘multiple wpdb instances don’t work.’ is closed to new replies.