Nhoufy
Nhoufy

Reputation: 53

Check if a column exists Codeigniter

How to check if a column exists in query builder Codeigniter 3? Example :

$query = $this->db->coluln_exists('column_name', 'table_name');
if($query == TRUE)
{
return TRUE;
} 
else
{
return FALSE;}

Thanks,

Upvotes: 2

Views: 7638

Answers (1)

imskm
imskm

Reputation: 805

if ($this->db->field_exists('field_name', 'table_name'))
{
        // some code...
}

You can see complete description here.

Upvotes: 7

Related Questions