galvin Posted September 18, 2009 Share Posted September 18, 2009 I'm getting stuck trying to figure this out and I know it's simple. I have a mysql table called 'cases' where each entry has an 'entrydate' field (i.e the date it's entered) in the format of: 2009-09-18 Each day, I want to pull everything from that table that only has TODAY's date (i.e. the current date). So I know this is close, but what goes where I have "**TODAY*** $sqlquery = "SELECT * FROM cases WHERE entrydate = **TODAY**"; $result = mysql_query($sqlquery); $numbercases = mysql_numrows($result); echo "<span class='numcases'> Today there are $numbercases cases.</span>"; Link to comment https://forums.phpfreaks.com/topic/174756-solved-pulling-things-just-for-today/ Share on other sites More sharing options...
YourNameHere Posted September 18, 2009 Share Posted September 18, 2009 // if you need the day to not have leading 0s then replace the "d" in the date() method to "j" //for example this code will format it like this 2009-09-01, but with "j" it will format like this 2009-09-1 $date=date('Y-m-d'); $sqlquery = "SELECT * FROM cases WHERE entrydate = '$date'"; $result = mysql_query($sqlquery); $numbercases = mysql_numrows($result); echo "<span class='numcases'> Today there are $numbercases cases.</span>"; Link to comment https://forums.phpfreaks.com/topic/174756-solved-pulling-things-just-for-today/#findComment-920960 Share on other sites More sharing options...
galvin Posted September 18, 2009 Author Share Posted September 18, 2009 awesome thank you !!!! Link to comment https://forums.phpfreaks.com/topic/174756-solved-pulling-things-just-for-today/#findComment-920963 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.