Is_array judgment doesn't work.
I just want to remove the repetition of the sizes field, write the array, and then output,
But when I write to the array, it doesn't seem to work with Is_array, and the results are all written in.
Or is there any better way to get rid of the repetition of this field?
This is the table.
$sizes = mysql_query ("Select sizes from Product");
$_sizearry = Array ();
while (!! $_sizes = mysql_fetch_array ($sizes)) {
if (!is_array ($_sizes[' sizes '],$_sizearry)) {
$_sizearry[] = $_sizes[' sizes '];
}
}
Print_r ($_sizearry);
foreach ($_sizearry as $size) {
echo $size;}? >
------Solution--------------------
Is_array () is not used to determine if there is duplicate data
SELECT DISTINCT
------Solution--------------------
Why is it Is_array? Check if it is an array?
if (!
In_array($_sizes[' sizes '],$_sizearry)) {
------Solution--------------------
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 '];