Is my SELECT syntax correct?

Hi guys I have query codes below,


$offering = 'test';
$query = $this->db->query("SELECT * FROM swap WHERE offering = $offering");
if ($query->num_rows() > 0)
{
   $row = $query->row();
   $swapid = $row->swap_id;
}		

Is my SELECT codes correct?
Please correct me if I’m wrong.

Thanks in advanced.

No. $offering contains a string, so you should put quotes around it.