-3

I want to print all database name list that are in my wamp server mysql and I'm getting some errors

 $link_id=mysqli_connect('localhost','root',"");
 $a=mysql_list_dbs($link_id);
 while($row = mysqli_fetch_object($a))
 {
     echo $row->Database."<br>";
     }

( ! ) Fatal error: Uncaught Error: Call to undefined function mysql_list_dbs() in C:\wamp64\www\connection.php on line 3

( ! ) Error: Call to undefined function mysql_list_dbs() in C:\wamp64\www\connection.php on line 3

Dharman
  • 30,962
  • 25
  • 85
  • 135

1 Answers1

0

You can not mix mysql_* and mysqli_* functions, they are two different APIs. The mysql_* functions have been deprecated and should no longer be used. mysqli_* doesn't have an equivalent function, but you can do mysqli_query($link_id, 'SHOW DATABASES') and then iterate over the results. See mysqli_query() for examples.

Alex Howansky
  • 50,515
  • 8
  • 78
  • 98