Welcome Guest, Not a member yet? Register   Sign In
Does CI3 Has any search library for MySQL DB?
#2

(This post was last modified: 03-16-2015, 03:12 AM by sajid19991. Edit Reason: spelling )

well, if there is or not....i  have decided to make it 3 days ago since i faced a lot of time wastage on search functions...so expect a library coming soon... but for now...

you can use in-built where clause for basic functions like..

Code:
$this->db->where('MATCH (content.title) AGAINST ("'. $term .'")')
$this->db->where('MATCH (content.body) AGAINST ("'. $term .'")')

or something like this

Code:
function search_results_count($terms)
   {
       // Run Query to count the total number of search results
       $sql = "SELECT COUNT(*) AS count
                   FROM content
                   WHERE MATCH (body) AGAINST (?)";
       $query = $this->db->query($sql, array($terms));
       return $query->row()->count;
   }

well i hope im right with those codes, been 3 years out of codeigniter...
Reply


Messages In This Thread
RE: Does CI3 Has any search library for MySQL DB? - by sajid19991 - 03-16-2015, 03:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB