Home > Backend Development > PHP Tutorial > PHP学习日记-检查数据库中某张表是否存在

PHP学习日记-检查数据库中某张表是否存在

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 13:36:24
Original
689 people have browsed it

直接上码

<?php//////////// $find_table 要查找的表名// $database 已经连接的数据库句柄function check_table_is_exist($find_table,$database) {    $sqlExce = "show tables "; // to show databases     $row = mysql_query($sqlExce,$database);    while ($result = mysql_fetch_array($row,MYSQL_NUM ))    {        for( $i = 0 ; $i < count($result); $i++){            if( $find_table ==  $result[$i]) {                // echo "found " . $find_table . '<br />';                return true;               }        }    }    return false;}?>
Copy after login

php myqsl_query
php mysql_fetch_array
php array

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template