Arrays - I may have gone blind

From: Date: Mon, 16 Dec 2002 11:59:22 +0000
Subject: Arrays - I may have gone blind
Groups: php.windows 
Request: Send a blank email to php-windows+get-17418@lists.php.net to get a copy of this message
Hi NG. I'm sure there is somthing implemented in PHP to do this but I just cant see it. I want to run through an array and remove some entries where <somthing 1> is true and <somthing 2> is lower than the other entries of <somthing 1> First i thought... hmm this sounds like a linked list, I'm gonna make one. But I cant seem to make the list concept work properly with PHP, so I thought that somthing might have been made for this. Example: for ($i = 0; $i < sizeof(some_db_result); $i++) { array[$i]['id'] = this_db_result_row['id']; array[$i]['type'] = this_db_result_row['type']; array[$i]['v_id'] = this_db_result_row['v_id']; } // (id) is unique // (type) is 1-4 // (v_id) is not unique. What I want to do is to find all entries where (v_id) is the same and then remove all but the one where (type) has the highest value. How do I do this? Or can a SQL statement do this in a DISTINCT like way? (SELECT table.id FROM table WHERE somthing is = somthing else and a lot of other stuff BUT only give me those where table.type has the hifgrst value)? Please... need help with this ~ Aidal.

« previous php.windows (#17418) next »