php - codeigniter active record using like,or,match in the same query -
i have been stuck in phase hour.
my purpose make search using table tag_name
, if in tag_name
give no_result want using product name table condition.or can result both condition above.
thanks kindness here:
function search_products($searchstr) { $this->db->select('a.*, b.,c.*,c.id id_product',false); $this->db->from('tags_events ',false); $this->db->join('products b','a.product_id = b.id ',false); $this->db->join('products_details c', 'b.id = c.product_id', 'left'); $this->db->where("match (tag_name) against ('{$searchstr}')or b.product_name '%$searchstr%' ", null, false); $this->db->group_by("b.product_name"); $query=$this->db->get(); return $query; }
i think problem solve if use mysql pattern matching
mysql provides standard sql pattern matching form of pattern matching based on extended regular expressions similar used unix utilities such vi, grep, , sed.
if needing explain detail, can visit link : http://dev.mysql.com/doc/refman/5.0/en/pattern-matching.html
Comments
Post a Comment