darubillah Posted March 21, 2011 Share Posted March 21, 2011 Hello, I am trying to fetch data which is one day old, I used now() function to insert current date, What could be the query?? <? //This query will select the data which is submitted today. $sql="SELECT * FROM table_name WHERE date=". now(); ?> so what will be the query to fetch yesterday's records, should be some thing done with now() function Thankyou Quote Link to comment https://forums.phpfreaks.com/topic/231252-selecting-data-which-is-submitted-1-day-beforeyesterday/ Share on other sites More sharing options...
gristoi Posted March 21, 2011 Share Posted March 21, 2011 try: $sql="SELECT * FROM table_name WHERE date(date)=DATE_SUB(CURDATE(), INTERVAL 1 DAY); Quote Link to comment https://forums.phpfreaks.com/topic/231252-selecting-data-which-is-submitted-1-day-beforeyesterday/#findComment-1190226 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.