SELECT * FROM table2 LEFT JOIN USING(user) WHERE table1.exp_date >=
$somedate;
or
SELECT * FROM table2 LEFT JOIN USING(user) WHERE table1.exp_date >= now();
-----Original Message-----
From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 12:00 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [PHP] Re: syntax for date math expressions


Okay, I've got 2 tables.  One has fields user, exp_date, the other has a
bunch of fields including user.  If the exp_date from the first table is
greater than $somedate (probably today's date), then I don't want to
show the records from the 2nd table.  Get it?

So how do I do this?

It doesn't seem apparently obvious to me how to do it in a single, or
multiple sql queries.

Thanks.

>>> "Maxim Maletsky" <[EMAIL PROTECTED]> 04/03/02 12:51PM
>>>

first of all your data seems to come from a DB to me. If it's so then
read 
your DB manual for date functions. It would be way better and faster. 

Otherwise, if you're so keen to let this duty job up to PHP then
convert 
both dates into UNIX time format 'maketime()' deduct the values and put
them 
through the 'date()' function. 

 


Maxim Maletsky 

Founder, Chief Developer
PHPBeginner.com (Where PHP Begins) 

www.PHPBeginner.com 
[EMAIL PROTECTED] 

 


ROBERT MCPEAK writes: 

> What is the php syntax for adding or subtracting dates? 
> 
> For example, I'd like to do something like this: 
> 
> 2002-04-03 - 2002-04-02 = 1 
> 
> or  
> 
> 2002-04-03 - 2002-04-02 = 0000-00-01 
> 
> or  
> 
> 2002-04-03 + 0000-00-01 = 2002-04-03 
> 
> etc. 
> 
> Can anybody help this newbie? 
> 
> Thanks! 
> 
>  
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php 
> 
 


Maxim Maletsky 

Founder, Chief Developer
PHPBeginner.com (Where PHP Begins) 

www.PHPBeginner.com 
[EMAIL PROTECTED] 

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


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

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

Reply via email to