wpdb confusion

Hey guys,

Multi-db issues seem to all be fine now. I do have one remaining issue I’m hoping you can help with.

I am using a 3rd-party (non-wpmudev) plugin for batch cloning sites. There seems to be an issue with a particular query via wpdb, and I can’t figure out if its a permissions thing or something that can’t be achieved in a multi-db set-up. The particular line is:

$template_tables = $wpdb->get_results( "SHOW TABLES LIKE '$temp_like%'", ARRAY_N );

The $temp_like in this case refers to the tables to be cloned. I get 0 results.

I thought that maybe using switch_to_blog before making the call would solve it. No luck.

In doing some digging I did find that 0 results would be returned if in fact there were no permissions to perform the query, however I suspect it could be a question of wpdb not having information about which DB I would like to SHOW TABLES for. With that in mind, I also tried SHOW TABLES FROM ‘the_db’ LIKE ‘the_prefix’… to no avail.

Any insight you can give would be appreciated.

Thanks!

  • Barry
    • DEV MAN’s Mascot

    Strange one that – multi-db should certainly work with SHOW TABLES LIKE – just checked on mine, it does.

    Can you get it to echo the SQL out to the screen and then let me know what the actual SQL is when the $temp_like is resolved to it’s value.

  • Mason
    • DEV MAN’s Sidekick

    Hiya,

    As we haven’t heard back from ya with any response in awhile I’m gonna mark this one resolved. If you’d like to go through anything further, feel free to re-open this thread. Alternately, you can also always open up a new one.

    Thanks!