Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

alternative of mysql_list_dbs in php

22 views
Skip to first unread message

array.ove...@gmail.com

unread,
Jan 30, 2017, 5:43:49 AM1/30/17
to
My Question is

alternative of mysql_list_dbs in php
pls write some answer at given url . i am waiting answer there
http://arrayoverflow.com/question/alternative-of-mysql-list-dbs-in-php/312

#mysql_list_dbs #deprecated #function #mysql #databaseList #query

array overflow

unread,
Jan 30, 2017, 5:53:09 AM1/30/17
to
isnt good question ?

J.O. Aho

unread,
Jan 30, 2017, 11:29:55 AM1/30/17
to
On 01/30/17 11:43, array.ove...@gmail.com wrote:

Note, don't multipost, do a crosspoost (one post which goes to multiple
newsgroups).
There is no direct replacement, but as it's just a stupid alias for
query with one and only one query that can be executed, "SHOW
DATABASES", so you can do it with mysqli (not tested):


<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

/* check connection */
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}

if ($result = $mysqli->query("SHOW DATABASES")) {

if($result){
// Cycle through results
while ($row = $result->fetch_object()){
echo $row ."\n";
}
// Free result set
$result->close();
}

$mysqli->close();
?>

or you can do it with PDO_MYSQL, but that example I leave to you to make
it yourself.

--

//Aho
0 new messages