I am running a while/foreach on a mySQL database and an array to check if it exists or not. It's supposed to loop 170 times but it loops over 12000 times. Why is that?
$my_rows = array();
while($row = mysql_fetch_assoc($run_query)){
$my_rows[] = $row;
foreach($my_rows as $row){
if(in_array_r($row['name'], $products)){
echo "Exists";
} else {
echo "Does not exist";
}
}
}