Groups | Search | Server Info | Keyboard shortcuts | Login | Register
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | "J.O. Aho" <user@example.net> |
| Newsgroups | alt.php.sql, comp.lang.php |
| Subject | Re: alternative of mysql_list_dbs in php |
| Date | Mon, 30 Jan 2017 17:29:52 +0100 |
| Lines | 49 |
| Message-ID | <ef9801Fll2rU1@mid.individual.net> (permalink) |
| References | <038b353b-a147-4d6f-a4a5-e323e7e2e6d3@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net mricu33ss/Tk2fKeQU5r2ApQGixMmtOHLyq6zWL3N6hE9aPpa3 |
| Cancel-Lock | sha1:CrIGEF1pMg6CLUKKHM45VFeDC8A= |
| X-Enigmail-Draft-Status | N1110 |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 |
| In-Reply-To | <038b353b-a147-4d6f-a4a5-e323e7e2e6d3@googlegroups.com> |
| Xref | csiph.com alt.php.sql:5 comp.lang.php:17317 |
Cross-posted to 2 groups.
Show key headers only | View raw
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