Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other DB name

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #42570
    almcrorie
    Participant

    in my sidebar.php, I would like to display the WordPress database name used? can I do it and if so, how? trying to find information like this in the codex is like going through a haystack looking for a needle.

    Al

    #123816
    TylerNYC
    Member

    Re-posting.

    #123817
    TylerNYC
    Member

    // Usage without mysql_list_dbs()
    $link = mysql_connect(‘localhost’, ‘mysql_user’, ‘mysql_password’);
    $res = mysql_query(“SHOW DATABASES”);

    while ($row = mysql_fetch_assoc($res)) {
    echo $row . “n”;
    }

    // Deprecated as of PHP 5.4.0
    $link = mysql_connect(‘localhost’, ‘mysql_user’, ‘mysql_password’);
    $db_list = mysql_list_dbs($link);

    while ($row = mysql_fetch_object($db_list)) {
    echo $row->Database . “n”;
    }
    ?>

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Other’ is closed to new topics and replies.