亚洲一级免费看,特黄特色大片免费观看播放器,777毛片,久久久久国产一区二区三区四区,欧美三级一区二区,国产精品一区二区久久久久,人人澡人人草

php語言

PHP獲取MySQL數(shù)據(jù)庫里所有表的實現(xiàn)代碼

時間:2025-05-28 18:27:51 php語言 我要投稿
  • 相關(guān)推薦

PHP獲取MySQL數(shù)據(jù)庫里所有表的實現(xiàn)代碼

  如何獲取某個MySQL數(shù)據(jù)庫中所有表的PHP代碼如下,需要的朋友可以參考下。跟隨小編去看看啊!

  代碼如下:

  function list_tables($database)

  {

  $rs = mysql_list_tables($database);

  $tables = array();

  while ($row = mysql_fetch_row($rs)) {

  $tables[] = $row[0];

  }

  mysql_free_result($rs);

  return $tables;

  }

  但由于mysql_list_tables方法已經(jīng)過時,運行以上程序時會給出方法過時的提示信息,如下:

  復(fù)制代碼 代碼如下:

  Deprecated: Function mysql_list_tables() is deprecated in … on line xxx

  一個處理辦法是在php.ini中設(shè)置error_reporting,不顯示方法過時提示信息

  復(fù)制代碼 代碼如下:

  error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED

  另一個方法是使用PHP官方推薦的替代做法:

  復(fù)制代碼 代碼如下:

  function list_tables($database)

  {

  $rs = mysql_query("SHOW TABLES FROM $database");

  $tables = array();

  while ($row = mysql_fetch_row($rs)) {

  $tables[] = $row[0];

  }

  mysql_free_result($rs);

  return $tables;

  }

【PHP獲取MySQL數(shù)據(jù)庫里所有表的實現(xiàn)代碼】相關(guān)文章:

PHP讀取MySQL數(shù)據(jù)的代碼方法10-21

PHP讀取MySQL數(shù)據(jù)代碼方法08-29

php連接mysql數(shù)據(jù)庫代碼08-01

php向Mysql數(shù)據(jù)庫保存數(shù)據(jù)的代碼09-12

PHP向MySQL數(shù)據(jù)庫保存數(shù)據(jù)代碼10-25

PHP如何執(zhí)行MySql語句查詢獲得表內(nèi)所有數(shù)據(jù)08-05

php獲取json數(shù)據(jù)所有的節(jié)點路徑11-07

php獲取新浪微博數(shù)據(jù)API的實例代碼08-06

PHP 中 MySQL 數(shù)據(jù)庫異步查詢實現(xiàn)08-22