array_unique is to be used by passing the array name as a parameter.
But as far as all the online examples researched go, it shows the arrays first being assigned to a single variable at the time they are instantiated, like so:
$var1 = $array['val1', 'val2', 'val3']
The only problem is, i am assigning the values of my array 1 at a time via a loop, so i dont know how to assign my array as a whole to a variable.
So how can i represent the entire array to either put in a variable or pass as a parameter for array_unique directly, without having to reference the specific array values?
Edit: Added the loop where array values are instantiated, as requested.
$productsQueryResult = mysql_query($productsQuery);
while ($row = mysql_fetch_row($productsQueryResult))
{
$array[$i] = $row[0];
$i++;
}
Simply pass name of the array as parameter: