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"; Quote 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. Quote 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. Quote 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? Quote 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 NOW() works on a MySQL server, are you using MySQL or MSQL? MSSQL Quote 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. Quote 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 NOW() does not work on MSSQL. Substitute NOW() with GETDATE() in the above provided example. That did it! THANKS! Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/139476-solved-datetime-querystring-problems/#findComment-729640 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.