MySQLi Table Exists

后端 未结 5 434
無奈伤痛
無奈伤痛 2021-01-15 00:33

In PHP, what would be the best way of seeing if a table exists?

This is what I am using so far

public function TableExists($table) {
    $res = $thi         


        
5条回答
  •  长发绾君心
    2021-01-15 01:09

    $con = mysqli_connect($hostname,$username,$password,$database);
    
    if(mysqli_num_rows(mysqli_query($con,"SHOW TABLES LIKE 'accman'"))) {
      echo "DB EXIST";
    } else {
      echo "DB Not Exist";
    }
    

提交回复
热议问题