Hello i’m going to check duplicated data from selected data but my code is not working properly
the my code is:
$cs="0";
$location=array();
$check=array(); $check[0]="";
while ($db_field = mysql_fetch_array($result)) {
for ($z=0; $z<=$cs;$z++){
if($check[$z]==$db_field['location']) {
//*in here going to check same or not
}
else {
//*if not same $location_c[$cs] will get
$location_c[$cs]= $db_field['location'];
$check[$cs]= $db_field['location'];
}
}
$cs++;
}
this code prints all data not checking duplicated data.
I think you should use
in_array()to avoid duplication, I’ve also removed unnecessary things :