Re: [PHP] while loop

2005-02-23 Thread Justin Lilly
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 <[EMAIL PROTECTED]> wrote:
> 
> 
> Hey list
> 
>  
> 
> I have a mysql table like this:
> 
>  
> 
> Act_name   Act_type_id  Act_date
> 
> Heyhey 1  22-06-05
> 
> Aloha2  22-06-05
> 
> Tralala   2  22-06-05
> 
> Wuhu1  22-06-05
> 
> Hehe 3  22-06-05
> 
> Olalal3  22-06-05
> 
> Pompom   1  22-06-05
> 
> Wuhu2  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



Re: [PHP] Like ternary but without the else.

2005-02-25 Thread Justin Lilly
This should do the trick:

$something ? $this=$that

-justin


On Fri, 25 Feb 2005 10:36:36 -0800, Chris W. Parker
<[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I couldn't find this anywhere on google or PHP's site but I'm pretty
> sure there's an answer to it.
> 
> How can I turn the following into something that resembles the ternary
> operator?
> 
>  
>   if($something)
>   {
> $this = $that;
>   }
> 
> ?>
> 
> I seem to remember it looking something like:
> 
>  
>   $this = ($something) || $that;
> 
> ?>
> 
> Although this isn't syntactically wrong, i.e. no errors, it did not do
> what I hoped it would do. (What it does is assign 1/true.)
> 
> Thanks!
> Chris.
> 
> p.s. No need to respond if your suggestion is:
> 
>  
>   if($something) { $this = $that; }
> 
> ?>
> 
> --
> 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



Re: [PHP] break/exit

2005-02-27 Thread Justin Lilly
how about an if else statement?

-justin


On Sun, 27 Feb 2005 09:55:23 +, timothy johnson
<[EMAIL PROTECTED]> wrote:
> I have a single php script that I am using to upload my gaim logs to a
> mysql server, but I want to put in some type of means to where if that
> log was already added then it will exit. what ways would you
> recommend?
> 
> --
> 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



Re: [PHP] [semi OT]: Planning projects

2005-03-22 Thread Justin Lilly
Well this one hasn't been offered yet:

I just subscribed to php|architect and there was an article in either
the Feb or March issue (I got them 1 day apart so I don't remember off
hand) about a system of design. I'll try not to give too much away,
but it used index cards. The index cards each represented a class.
They were split down the center and on one side the methods of the
class was named and on the right the right, all of the class's
dependencies were written down. So a DB class might have a dependancy
on the DB software and related functions. A session handling class,
however, might call a method of setCookie or sessionHandler or some
such.

Oh, and for those of you who don't currently subscribe to php|arch, I
would suggest it. It has some interesting articles about subjects and
technologies relating to php that you won't find elsewhere. Not only
that, but these guys know what they're talking about.

That's just my $.02
-justin
-- 
Justin Lilly
University of South Carolina

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php