Reply to Re: [PHP] while loop

Your name:

Reply:


Posted by Justin Lilly on 02/23/05 19:56

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@domos.be> 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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация