Is_array does not work. I just want to remove the repeated sizes fields, write them to the array, and then output them,
However, when writing an array, I used IS_ARRAY to judge whether it worked, and the results were written into the array.
Or there is no better way to remove this field duplication.
This is a table
$ Sizes = mysql_query ("SELECT sizes FROM product ");
$ _ Sizearry = array ();
While (!! $ _ Sizes = mysql_fetch_array ($ sizes )){
If (! Is_array ($ _ sizes ['sizes'], $ _ sizearry )){
$ _ Sizearry [] =_ _ sizes ['size'];
}
}
Print_r ($ _ sizearry );
Foreach ($ _ sizearry as $ size ){
Echo $ size ;}?>
Reply to discussion (solution)
Print_r ($ _ sizearry); this sentence is a test and useless.
In addition, the issue was raised during output.
Is_array () is not used to determine whether duplicate data exists.
Select distinct
How is is_array? Check whether it is an array?
If (! In_array ($ _ sizes ['sizes'], $ _ sizearry )){
Whether is_array () is an array type
In_array () determines whether the array has this key value.
while (!!$_sizes = mysql_fetch_array($sizes)){ if (!in_array($_sizes['sizes'],$_sizearry)) { $_sizearry[] = $_sizes['sizes'];
It's actually just group.