Jump to content

Php and database tables


jokerofsouls

Recommended Posts

Use the SHOW DATABASES sql command to get all the databases that currently exist. Then use a while loop to loop through the available databases, eg

 

$sql = 'SHOW DATABASES';
$result = mysql_query($sql) or die ('MySQL Error: ' . mysql_error());

$my_database = 'YOUR DATABASE NAME';

while(list($db_name) = mysql_fetch_row($result))
{
    if($db_name == $my_database )
    {
        echo $my_database . ' exists!';
    }
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.