2013-07-22 3 views

답변

1

당신이 테이블을 확인하려면 다음이 쿼리

$query = $this->db->query("SHOW TABLES LIKE mytable_name"); 

을 실행 그것은 것입니다 결과 이름 mytable_name로하고이 does'nt 경우가 null 결과 다음 모든 테이블을 존재하는 테이블.

또는 그러한 조항이 없습니다

if ($this->db->table_exists('mytable_name')) { 
    echo 'Table is already exists'; 
} else { 
    CREATE table 
} 
+1

그러나, 당신은이 같은 where 절에 "절을 존재하지"당신을 전달할 수 있습니다 /exists-and-not-exists-subqueries.html) ...? –

0

처럼 단순히 당신이 시도 할 수는 활성 레코드에 "하지 존재". 내가 http://dev.mysql.com/doc/refman/5.0/en [이] (그가 의미한다고 생각

$this->db->where('NOT EXISTS ');