mysqli list database names

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
amichael
Forum Newbie
Posts: 2
Joined: Thu Nov 26, 2009 2:10 pm

mysqli list database names

Post by amichael »

I've never had to find a list of MySQL database names before using PHP. I see that there is a mysql_list_dbs() function, but I see no equivalent using mysqli. Haven't found any info using google.

How can I grab a list of database names using mysqli? Is there a function or some sort of query I can run?

Thanks in advance!
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: mysqli list database names

Post by pickle »

SHOW DATABASES() is a query you can run. 5 minutes of searching the docs & Googling didn't show me any other way to do it.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
amichael
Forum Newbie
Posts: 2
Joined: Thu Nov 26, 2009 2:10 pm

Re: mysqli list database names

Post by amichael »

Works perfectly. Thanks pickle.
Post Reply