Perhaps it is just me, but wouldn't it be easier to make individual mysql queries for each different act type? That would make the sorting -much- easier. I'm not sure if that's an option, but if it is, I'd consider exploring it. select * from activities where act_date >= NOW() && act_type_id = 1 or something of that nature. -justin On Wed, 23 Feb 2005 13:05:53 +0100, Reinhart Viane <rv@xxxxxxxx> wrote: > > > Hey list > > > > I have a mysql table like this: > > > > Act_name Act_type_id Act_date > > Heyhey 1 22-06-05 > > Aloha 2 22-06-05 > > Tralala 2 22-06-05 > > Wuhu 1 22-06-05 > > Hehe 3 22-06-05 > > Olalal 3 22-06-05 > > Pompom 1 22-06-05 > > Wuhu 2 22-06-05 > > > > Now I retrieve all activities happening in the future with this query: > > $sqlact="select * from activities where act_date >= NOW() order by > act_type_id"; > > $getact=mysql_query($sqlact) > > > > What I'm trying to do now is: > > From the result array, pick from every different act_type_id the two > activities that will happen first and put them in 2 variables > > Eg. > > The two act_date with act_type_id 1 > > Should be stored in > > $Act1result1 and $act1result2 > > > > The two act_date with act_type_id 2 > > Should be stored in > > $Act2result1 and $act2result2 > > > > I think this can be done with a loop in a loop but I always manage to create > some errors causing my apache to crash (infinite loop I suppose) > > Can someone help me on this? > > > > Thx in advance > > > > Reinhart > > > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Justin Lilly University of South Carolina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php