I just want a simple explanation on what does this CONCAT and LIKE does in this code. Thank you.
$data = $this->request->data;
$conditions = array('authenid' => $data['id'], 'isblacklist' => $data['isblacklist']);
if( $data['key'] == "msisdn" ) {
if(isset ($data["search"])){
if( trim($data["search"]) != "" ) {
$conditions[ "CONCAT(msisdn,',',ton,',',npi) LIKE" ] = "%".trim($data["search"])."%";
}
}
$tmpData = $this->blkwhtlist_msisdn->find('all', array(
'conditions' => $conditions
));
I guess you are trying querys in mysql db:
CONCAT is a string function to concatenate in mysql:
CONCAT('abc', '.de') that return a string 'abc.de'
And the LIKE is a mysql operator used to select data based on patterns. Therefore the LIKE operator is often used in the WHERE clause of the SELECT statement. mysql provides two wildcard characters for using with the LIKE operator, the percentage % and underscore _.