[UPHPU] PHP dates MySQL

Webot Graphics graphics at westernbotanicals.com
Fri Apr 20 13:20:50 MDT 2007


Now I know what your thinking... "You should have been to the meeting  
last night," and believe me if I didn't have a prior engagement last  
night I would have been there.

to the problem.

I have a form which outputs 6 values.
$firstday = ($_GET['firstday']);
$firstmonth = ($_GET['firstmonth']);
$firstyear = ($_GET['firstyear']);
$secondday = ($_GET['secondday']);
$secondmonth = ($_GET['secondmonth']);
$secondyear = ($_GET['secondyear']);

and i try to format them into a date
$firstdate = date("Y-m-d", mktime(0,0,0,$firstmonth,$firstday, 
$firstyear));
$seconddate = date("Y-m-d", mktime(0,0,0,$secondmonth,$secondday, 
$secondyear));

which seems to work fine. But I try to match it against a MySQL  
database and it doesn't seem to work. Here is the statement
$sql1 = "SELECT * FROM Invoices INNER JOIN Invoice_Shipments ON  
Invoices.Invoice_ID = Invoice_Shipments.Invoice_ID WHERE  
(Invoice_Customer_ID = ('$customerid')) AND (dayofyear(Invoice_Date)  
 > dayofyear(('$firstdate')))";

If I take out the "AND (dayofyear(Invoice_Date) > dayofyear 
(('$firstdate')))" it works just fine, so I know the problem lies here.

thanks

Justin Giboney
www.forodeherbales.com




More information about the UPHPU mailing list