I am trying to get result from advertisement table by searching phone number from using mysql "LIKE" query. I tried many times but I did not get result.
public function searching($key){
$this->db->select('*');
$this->db->from('advertisement');
$this->db->where('phone',$key);
$query = $this->db->get();
if($query->num_rows()>0) {
echo "YES";
}
else{
echo "NO";
}
}
I got "YES" as a result when using "where" clause. But when I searching same phone number with "like" clause($this->db->like('phone',$key);
) instead of "where", I got "NO", as a result.
Adding it as an answer for future seekers.
The field PHONE is probably setup as an INTEGER and you cannot use LIKE on an integer. There will be a mysql error thrown but if debug is off or something else is turned off it will never show.