Skip to content

Instantly share code, notes, and snippets.

@andyhawthorne
Last active October 10, 2015 19:27
Show Gist options
  • Select an option

  • Save andyhawthorne/3739207 to your computer and use it in GitHub Desktop.

Select an option

Save andyhawthorne/3739207 to your computer and use it in GitHub Desktop.
method for counting search results
<?php
public function search_record_count($searchterm)
{
$sql = "SELECT COUNT(*) As cnt FROM Country
WHERE Continent LIKE '%" . $searchterm . "%'";
$q = $this->db->query($sql);
$row = $q->row();
return $row->cnt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment