phpSensei Posted July 15, 2007 Share Posted July 15, 2007 I have a little question... Can I use the SELECT statement, and Display all my data from a certain table depending on the date? If the date is newer then it will show that id, within the table? Any of this possible? I was thinking of this <?php $sql="SELECT * FROM table_1 ORDER BY date ASC"; $result=mysql_query($sql); $row=mysql_fetch_array($result); ?> Link to comment https://forums.phpfreaks.com/topic/60075-solved-date-times/ Share on other sites More sharing options...
AndyB Posted July 15, 2007 Share Posted July 15, 2007 SELECT .... WHERE date [some operator] [some date] for example date>'2006-07-14' Link to comment https://forums.phpfreaks.com/topic/60075-solved-date-times/#findComment-298805 Share on other sites More sharing options...
phpSensei Posted July 15, 2007 Author Share Posted July 15, 2007 Edit: I know what you mean but... I dont know which function will calculate the most current date. Link to comment https://forums.phpfreaks.com/topic/60075-solved-date-times/#findComment-298810 Share on other sites More sharing options...
AndyB Posted July 15, 2007 Share Posted July 15, 2007 Exactly how you resolve it depends on what format you've used for 'date' in your database. The date() function along with the strtotime() or mktime() functions ought to be able to handle most of what you need. list($y,$m,$d) = explode("-",date("Y-m-d"));// today $month_ago = date("Y-m-d", mktime(0,0,0,$m-1,$d,$y)); Link to comment https://forums.phpfreaks.com/topic/60075-solved-date-times/#findComment-298815 Share on other sites More sharing options...
phpSensei Posted July 15, 2007 Author Share Posted July 15, 2007 Exactly how you resolve it depends on what format you've used for 'date' in your database. The date() function along with the strtotime() or mktime() functions ought to be able to handle most of what you need. list($y,$m,$d) = explode("-",date("Y-m-d"));// today $month_ago = date("Y-m-d", mktime(0,0,0,$m-1,$d,$y)); Thankyou so much, My forum is done with everything. This was the only thing left. Link to comment https://forums.phpfreaks.com/topic/60075-solved-date-times/#findComment-298819 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.