Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

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      
0
jtrudeau
Asked:
jtrudeau
  • 4
  • 2
1 Solution
 
sirbountyCommented:
Have you tried ...

"WHERE Month(Date)= " & $today & " "
0
 
jtrudeauAuthor Commented:
what is with the ampersand ?
0
 
jtrudeauAuthor Commented:
and month(date) will do what, what you sent me it appears that month() is a function but the argument date ????
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
sirbountyCommented:
you might also try month(now()) or month(now)

date is equivalent of today's date.
now would include the time, but month would strip out the month from both...
0
 
jtrudeauAuthor Commented:
not working :(
0
 
jtrudeauAuthor Commented:
yes! it does work, I have another question posted go check it out so I could accept this answer and accept your next answer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now