MySQL Forums
Forum List  »  PHP

query help!
Posted by: Simon Kim
Date: October 10, 2012 05:54AM

Hi folks,

I need to change existing SQL queries which used MATCH AGAINST to one that uses LIKE syntax. I tried to change them myself but I don't think it's working. First line is the original line and second line(commented out) is what I tried.

Please someone help me with this.
Thanks
Simon

$this->dao->where(sprintf("MATCH(d.s_title, d.s_description) AGAINST('%s' IN BOOLEAN MODE)", $this->sPattern) );
//$this->dao->where(sprintf("d.s_title LIKE '%%%s%%' OR d.s_description LIKE '%%%s%%'", $this->sPattern, $this->sPattern) );


} else if(preg_match('/MATCH\(d\.s_title, d\.s_description\) AGAINST\(\'([\s\p{L}\p{N}]*)\' IN BOOLEAN MODE\)/u', $condition, $matches) ) { // OJO
//} else if(preg_match('/d\.s_title\s*LIKE\s*\'%([\s\p{L}\p{N}]*)%\' OR \.s_description\s*LIKE\s*\'%([\s\p{L}\p{N}]*)%\'/u', $condition, $matches) ) { // OJO

Options: ReplyQuote


Subject
Written By
Posted
query help!
October 10, 2012 05:54AM
October 11, 2012 07:04PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.