Php checks whether a table exists, and php checks whether the table exists. Php checks whether a table exists. php checks whether a table exists. this example describes how php checks whether a table exists. Share it with you for your reference. Specifically: php method 1 mysq php method for determining whether a table exists, php method for determining whether a table exists
This example describes how to use php to determine whether a table exists. Share it with you for your reference. The details are as follows:
<? Php // method 1 mysql_connect ('localhost', 'root', '000000') or die ('Can \'t not connect database'); if (int) check_table_is_exist ('Show databases; ', 'test') = 1) {echo' The table exists ';} else {echo' The table does not exist ';} function check_table_is_exist ($ SQL, $ find_table) {$ row = mysql_query ($ SQL); $ database = array (); $ finddatabase = $ find_table; while ($ result = mysql_fetch_array ($ row, MYSQL_ASSOC) {$ database [] = $ result ['database'];} unset ($ result, $ row ); mysql_close ();/* start to judge whether the table exists */if (in_array ($ find_table, $ database) {return true;} else {return false ;}} //////////////////////////////////////// ///// method 2 mysql_connect ('localhost ', 'root', 'root'); $ result = mysql_list_tables ('database'); $ I = 0; while ($ I
I hope this article will help you with php programming.
Examples in this article describes how to use php to determine whether a table exists. Share it with you for your reference. Details: php // method 1 mysq...