note 105847 deleted from function.mysql-db-name by tularis
| From: | tularis@php.net | Date: | Tue, 20 Sep 2011 18:31:04 +0000 |
| Subject: | note 105847 deleted from function.mysql-db-name by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183312@lists.php.net to get a copy of this message | ||
Note Submitter: jokeke at btinternet dot com
Reason: bad code
----
You can also display the database name in use, like so...
<?php
error_reporting(E_ALL);
$link_id = mysql_connect();
$use_db = mysql_select_db('menagerie', $link_id);
$db_list = mysql_list_dbs($link_id);
mysql_db_name($db_list, $row = $use_db);
echo 'You are currently using the '.mysql_db_name($db_list, $row).' database!';
?>
This code will output "You are currently using the menagerie database!"