My program uses the following for loops to search customer records. $search_customers are the records being searched for and $g_u is the result set from mySQL query.
Without these loops the search doesn't work. However with these loops when the page loads I receive a mySQL Server has gone away error. If I remove these loops the page loads fine but the search is inoperative. Is there a faster way to loop thru these items and make the comparison?
Code:
for ($i=0; $i<sizeof($g_u); $i++){
for ($x=0; $x<sizeof($search_customers); $x++){
if ($g_u[$i]['user_id'] == $search_customers[$x]['user_id']){
$group_users[$count] = $g_u[$i];
$count++;
}
}
}
Without these loops the search doesn't work. However with these loops when the page loads I receive a mySQL Server has gone away error. If I remove these loops the page loads fine but the search is inoperative. Is there a faster way to loop thru these items and make the comparison?