Groups | Search | Server Info | Keyboard shortcuts | Login | Register
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Newsgroups | alt.php.sql, comp.lang.php |
| Subject | Re: alternative of mysql_list_dbs in php |
| Date | 2017-01-30 17:29 +0100 |
| Message-ID | <ef9801Fll2rU1@mid.individual.net> (permalink) |
| References | <038b353b-a147-4d6f-a4a5-e323e7e2e6d3@googlegroups.com> |
Cross-posted to 2 groups.
On 01/30/17 11:43, array.overflow2017@gmail.com wrote:
Note, don't multipost, do a crosspoost (one post which goes to multiple
newsgroups).
> 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
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
Back to alt.php.sql | Previous | Next — Previous in thread | Find similar
alternative of mysql_list_dbs in php array.overflow2017@gmail.com - 2017-01-30 02:43 -0800 Re: alternative of mysql_list_dbs in php array overflow <array.overflow2017@gmail.com> - 2017-01-30 02:53 -0800 Re: alternative of mysql_list_dbs in php "J.O. Aho" <user@example.net> - 2017-01-30 17:29 +0100
csiph-web