Hi again ,,,
Just want to refresh this issue and make it more clear
the following is a sample portion taken from my code :
Code: Select all
<?php
.
...
....
.....
## Construct country query
//.................................................................
if(is_array($c_code))// $c_code is an array that holds country codes e.g. : 25,44,85,47
{
$array_size=sizeof($c_code);
if($array_size>5);// die("Maximum criteria reached");
for($i = 0; $i < $array_size - 1 ; $i++){
$RES.=" ccode_field REGEXP '^".$c_code[$i].",|,".$c_code[$i].",|^".$c_code[$i]."$|,".$c_code[$i]."$' or";
}
$RES.=" ccode_field REGEXP '^".$c_code[$array_size-1].",|,".$c_code[$array_size-1].",|^".$c_reside[$array_size-1]."$|,".$c_code[$array_size-1]."$'";
}else{
$RES.=" ccode_field REGEXP '^".$c_code.",|,".$c_code.",|^".$c_code."$|,".$c_code."$'";
}
//.................................................................
## Construct country query
$Query="SELECT DISTINCT(user_id) WHERE ".$RES;
$Results=mysql_query($Query);
//.................................................................
?>
Note :
$Query value will looks like "SELECT DISTINCT(user_id) WHERE ccode_field REGEXP '^22,|,22,|^22$|,22$' AND ccode_field REGEXP '^35,|,35,|^35$|,35$' AND ccode_field REGEXP '^44,|,44,|^44$|,44$' ...."
as we can see, $Query will produce a long query terms that might slow down searching process.
So again, is there such a way to speed up my searching process and if there are any alternatives for doing the same gool in effecient way.
Regards ..
Mishal