This is long-winded, but my current setup is a WordPress multisite that is distributed over 256 databases (performance reasons). When sites are generated, a script auto-populated the WP tables needed onto a randomly selected database. The science is beyond my understanding completely.
Anyways, I have a need to alter data on a table for one of my sites. I need to find out which database its table reside. A long while ago, I had success with this:
<?php
$query="select database() AS <code>db</code>";
$result=mysql_query($query);
$row = mysql_fetch_assoc($result);
echo 'database: '.$row['db'].'<p>';
?>
That no longer seems to function and looks like it has deprecated functions. Any help would be greatly appreciated. Thanks!