Skip to content

Instantly share code, notes, and snippets.

@andyhawthorne
Last active December 20, 2015 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyhawthorne/6197610 to your computer and use it in GitHub Desktop.
Save andyhawthorne/6197610 to your computer and use it in GitHub Desktop.
<?php
public function search($searchterm,$limit)
{
$sql = "SELECT * FROM Country
WHERE Continent LIKE '%" . $searchterm . "%' LIMIT " .$limit . ",20";
$q = $this->db->query($sql);
if($q->num_rows() > 0)
{
foreach($q->result() as $row)
{
$data[] = $row;
}
return $data;
}
else
{
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment