PHP/MySQL Database/mysql tablename

Материал из Web эксперт
Перейти к: навигация, поиск

Listing databases

   <source lang="html4strict">

<?php $conn = @mysql_connect( "localhost", "userName", "password" ) or die( "Sorry - could not connect to MySQL" ); $rs= @mysql_list_dbs( $conn ) or die( "Sorry - could not list databases" ); for( $row=0; $row < mysql_num_rows($rs); $row++ ){

 $db_list .= mysql_tablename( $rs, $row ) . "
";

}

?> <html>

<head>
 <title>Listing databases</title>
</head>
<body>

<?php echo( $db_list ); ?>

</body>

</html>

 </source>
   
  


mysql_tablename.php

   <source lang="html4strict">

<?php

  mysql_connect("localhost","webuser","secret");
  $tables = mysql_list_tables("company");
  $count = 0;
  while ($count < mysql_numrows($tables))
  {
     echo mysql_tablename($tables,$count)."
"; $count++; }

?>

 </source>