Hi,
I need to get unique entrys from a database based on description of a product, Select Unique only works if I do a single selection but i need to select multible table rows. I tried using array_unique on the resulting array but that fails due to it being a multidimensional array. I tried using a function but I get an error in the foreach clause the function follows;
function unique_multi_array($array, $sub_key) {
$target = array();
$existing_sub_key_values = array();
foreach ($array as $key=>$sub_array) {
if (!in_array($sub_array[$sub_key], $existing_sub_key_values)) {
$existing_sub_key_values[] = $sub_array[$sub_key];
$target[$key] = $sub_array;
}
}
return $target;
}
$filtered = unique_multi_array($get_items_res, $item_title );
get_items_res is the result of the select and query $item_title is part of the array i wish to run unique on. I have several books and spent lots of time learning php but I have a long way to go. thanks