mysql 检查表是否存在

1
2
3
4
5
6
7
        //check back table exists
        $back_db $this->_cust_bak_db;
        $table 'voucher_'.date('Ym',strtotime($month));
 
        $sql = "select count(*) as cnt 
        from `INFORMATION_SCHEMA`.`TABLES` 
        where `TABLE_SCHEMA`='$back_db' and `TABLE_NAME`='$table'";