Listing databases

PythonPython Forum LeaderThe Royal RAM
I know how to get information from a database -thats fairly simple but what about actually listing the databases itself...

For example on my host Im using about 6 databases - How would I get a script to output the names of each of them?

Thanks

The Royal Ram

Comments

  • martian2k4martian2k4 Llama Hunter Moderator
    [PHP]

    <?php

    $conn = mysql_connect("localhost","USER","PASS");

    mysql_select_db("DB_NAME", $conn);

    $list = mysql_list_dbs($conn);

    for ( $i = 0; $i > mysql_num_rows ( $list ); $i++);

    {

    $dis .= mysql_tablename( $list, $i )." <br><br>";

    }

    echo($dis);

    ?>

    [/PHP]

    Hope it helps (And works :p)
    Free MySpace Layouts- Coming soon
    Photoshop Tutorials- Coming soon
    Premium PHP Scripts- Coming soon

    Haha i should really do some work so i can remove all the coming soon's
Sign In or Register to comment.