Hi all I have a mysql database with a table. What I'd like to do is to scan a speciffic row in that table for unique values and put the values in an array. If, fx, the value gimp occurs twice in the row, only the first occurrence should be put in the array. Does anyone have a sollution to this, that they would like to share? thanks
$rst=mysql_query($sqlstatement); while($row_of_fields=msql_fetch_assoc($rst)) { foreach($row_of_fields as $key=>$value) { if(!$check_array[$value]) { $use_array[$key]=$value; $check_array[] = $value; } } //do something with $use_array unset($check_array); } PHP: takes a tablerow as associative array $key (=fieldname), $value tests against $check_array to see if $value is missing if so, add $key, $value to $use_array add $value to $check_array if $value isn't missing from $check_array, it skips to the next field Haven't tested it.