The customers can have 3 different phone numbers, and I want to retrive these from the database, based on the numbers in my array phone.
function statsUserRing($phone, $link)
{
$i = 0;
$p1 = preg_replace( '/[^0-9]/', '', $phone[0]);
$p2 = preg_replace( '/[^0-9]/', '', $phone[1]);
$p3 = preg_replace( '/[^0-9]/', '', $phone[2]);
while($get_stats = $link->get_object("SELECT REPLACE(telnr,'-', '') as telnr FROM ringupp WHERE telnr LIKE '%$p1%' OR telnr LIKE '%$p2%' OR telnr LIKE '%$p3%'"))
{
$i++;
}
return $i;
}
Im trying with a customer that have 2 phone numbers registred. So my array contains 2 values, which is these numbers.
Those 2 numbers appears 16 times in my ringupp table, but when I run my code above, it counts it to 204154. Why?