Hi guys I have query codes below,

Code:
$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.