Link to home
Start Free TrialLog in
Avatar of jtrudeau
jtrudeau

asked on

searching by the month only

Im try to find the right query to compare the month only of the last record, if the month is the current month do something


$today = date("m");

$obj = mysql_query ("SELECT DATE_FORMAT(printDate, '%m') AS f_date FROM prints ORDER BY printDate DESC LIMIT 0,1")
     or die ("Invalid query");
$oRow = mysql_fetch_object($obj);

I would think to put a WHERE is the query but doesnt sound like it would work properly

please help me out      
Avatar of sirbounty
sirbounty
Flag of United States of America image

Have you tried ...

"WHERE Month(Date)= " & $today & " "
Avatar of jtrudeau
jtrudeau

ASKER

what is with the ampersand ?
and month(date) will do what, what you sent me it appears that month() is a function but the argument date ????
ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
not working :(
yes! it does work, I have another question posted go check it out so I could accept this answer and accept your next answer