PHP/MySQL Database/Database MetaData

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

Get MySQL client information

   <source lang="html4strict">

<?php

  mysql_connect("mysql153.secureserver.net","wbex","password");
  echo mysql_get_client_info();

?>

      </source>
   
  


Get MySQL host information

   <source lang="html4strict">

<?php

  mysql_connect("mysql153.secureserver.net","wbex","password");
  echo mysql_get_host_info();

?>

      </source>
   
  


Get MySQL server information

   <source lang="html4strict">

<?php

  mysql_connect("mysql153.secureserver.net","wbex","password");
  echo mysql_get_server_info();

?>

      </source>
   
  


List all database

   <source lang="html4strict">

<?php

  mysql_connect("mysql153.secureserver.net","wbex","password");
  $dbs = mysql_list_dbs();
  echo "Databases: 
"; while (list($db) = mysql_fetch_row($dbs)) { echo "$db
"; }

?>

      </source>
   
  


List all tables in a database

   <source lang="html4strict">

<?php

  mysql_connect("mysql153.secureserver.net","wbex","password");
  $tables = mysql_list_tables("wbex");
  while (list($table) = mysql_fetch_row($tables)) {
     echo "$table 
"; }

?>


      </source>
   
  


Print all MySQL status value

   <source lang="html4strict">

<?php

  mysql_connect("mysql153.secureserver.net","wbex","password");
  $status = explode(" ", mysql_stat());
  foreach($status as $value) echo $value."
";

?>


      </source>