rondog Posted April 10, 2008 Share Posted April 10, 2008 I have a date field that looks like this: 6/9/2008 I was wondering how I could test the current date against what in the DB. Its an events database and I dont want to select events that have already passed. How could I do that? thanks. Link to comment https://forums.phpfreaks.com/topic/100423-select-all-from-todays-date-forward/ Share on other sites More sharing options...
awpti Posted April 10, 2008 Share Posted April 10, 2008 Why aren't you using MySQL DATETIME field type? Link to comment https://forums.phpfreaks.com/topic/100423-select-all-from-todays-date-forward/#findComment-513600 Share on other sites More sharing options...
uniflare Posted April 10, 2008 Share Posted April 10, 2008 personally id use a timestamp. but FYI you should only ever use mysql date functions or timestamps as date fields in tables, timestamps would make this particular situation very easy indeed. Link to comment https://forums.phpfreaks.com/topic/100423-select-all-from-todays-date-forward/#findComment-513635 Share on other sites More sharing options...
rondog Posted April 10, 2008 Author Share Posted April 10, 2008 I didn't set the database up unfortunately otherwise I would have. Also, its a mssql db if that makes a difference. Link to comment https://forums.phpfreaks.com/topic/100423-select-all-from-todays-date-forward/#findComment-513911 Share on other sites More sharing options...
rondog Posted April 10, 2008 Author Share Posted April 10, 2008 ok I found the previous ASP file that does what I am wanting to achieve with the same database <% strSelectSQL = "SELECT * FROM DE_Events WHERE event_date >= '" & date & "' order by event_date" %> I dont see 'date' defined anywhere so I am guessing date is equivelant to PHPs date("m/d/Y"); If I echo date("m/d/Y"); it echoes out 4/10/2008 I cant test this right now because I am not home, but does the >= sign work with MySQL since that SQL string is for a MS SQL db? Link to comment https://forums.phpfreaks.com/topic/100423-select-all-from-todays-date-forward/#findComment-513990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.