selliott Posted January 5, 2009 Share Posted January 5, 2009 I'm not real familiar with PHP, so I can quite get this querystring to work. Anyone see what I'm doing wrong? $date='DateTime.Now.ToString("yyyyMMdd")'; $QueryString="SELECT Top 5 * FROM red.apples WHERE Terminate > '$date' ORDER BY ViewCount DESC"; Link to comment https://forums.phpfreaks.com/topic/139476-solved-datetime-querystring-problems/ Share on other sites More sharing options...
ratcateme Posted January 5, 2009 Share Posted January 5, 2009 where did u get $date='DateTime.Now.ToString("yyyyMMdd")'; from try $QueryString="SELECT Top 5 * FROM red.apples WHERE Terminate > NOW() ORDER BY ViewCount DESC"; Scott. Link to comment https://forums.phpfreaks.com/topic/139476-solved-datetime-querystring-problems/#findComment-729618 Share on other sites More sharing options...
selliott Posted January 5, 2009 Author Share Posted January 5, 2009 When I try that, an error says 'NOW' is not a recognized function name I'm on a windows server if that makes a difference. Link to comment https://forums.phpfreaks.com/topic/139476-solved-datetime-querystring-problems/#findComment-729623 Share on other sites More sharing options...
bubbasheeko Posted January 5, 2009 Share Posted January 5, 2009 NOW() works on a MySQL server, are you using MySQL or MSQL? Link to comment https://forums.phpfreaks.com/topic/139476-solved-datetime-querystring-problems/#findComment-729628 Share on other sites More sharing options...
selliott Posted January 5, 2009 Author Share Posted January 5, 2009 Quote NOW() works on a MySQL server, are you using MySQL or MSQL? MSSQL Link to comment https://forums.phpfreaks.com/topic/139476-solved-datetime-querystring-problems/#findComment-729632 Share on other sites More sharing options...
bubbasheeko Posted January 5, 2009 Share Posted January 5, 2009 NOW() does not work on MSSQL. Substitute NOW() with GETDATE() in the above provided example. Link to comment https://forums.phpfreaks.com/topic/139476-solved-datetime-querystring-problems/#findComment-729633 Share on other sites More sharing options...
selliott Posted January 5, 2009 Author Share Posted January 5, 2009 Quote NOW() does not work on MSSQL. Substitute NOW() with GETDATE() in the above provided example. That did it! THANKS! Link to comment https://forums.phpfreaks.com/topic/139476-solved-datetime-querystring-problems/#findComment-729638 Share on other sites More sharing options...
bubbasheeko Posted January 5, 2009 Share Posted January 5, 2009 No problem....glad I could help! Link to comment https://forums.phpfreaks.com/topic/139476-solved-datetime-querystring-problems/#findComment-729640 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.