PHP/MySQL Database/Database MetaData

Материал из Web эксперт
Версия от 07:06, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Get MySQL client information

<?php
   mysql_connect("mysql153.secureserver.net","wbex","password");
   echo mysql_get_client_info();
?>



Get MySQL host information

<?php
   mysql_connect("mysql153.secureserver.net","wbex","password");
   echo mysql_get_host_info();
?>



Get MySQL server information

<?php
   mysql_connect("mysql153.secureserver.net","wbex","password");
   echo mysql_get_server_info();
?>



List all database

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



List all tables in a database

<?php
   mysql_connect("mysql153.secureserver.net","wbex","password");
   $tables = mysql_list_tables("wbex");
   while (list($table) = mysql_fetch_row($tables)) {
      echo "$table <br />";
   }
?>



Print all MySQL status value

<?php
   mysql_connect("mysql153.secureserver.net","wbex","password");
   $status = explode(" ", mysql_stat());
   foreach($status as $value) echo $value."<br />";
?>