while loop
| From: | Reinhart Viane | Date: | Wed, 23 Feb 2005 12:05:53 +0000 |
| Subject: | while loop | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-209226@lists.php.net to get a copy of this message | ||
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