while loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux