PHP/MySQL Database/Database MetaData — различия между версиями

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

Текущая версия на 07:06, 26 мая 2010

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 />";
?>