rkstevens Posted May 6, 2008 Share Posted May 6, 2008 My database table has two values: PostDate that contains a timestamp when the record can be displayed RemoveDate contains the timestamp when the record can no longer be displayed The query: $newsquery = "SELECT * FROM News WHERE ((PostDate < 'time()') AND (RemoveDate > 'time()')) ORDER BY PostDate DESC"; returns 0 records, when there are ones that are within the range. I guess I have something wrong. Link to comment https://forums.phpfreaks.com/topic/104422-solved-return-a-specified-range-from-database/ Share on other sites More sharing options...
Barand Posted May 6, 2008 Share Posted May 6, 2008 time() is PHP function. try $newsquery = "SELECT * FROM News WHERE UNIX_TIMESTAMP() BETWEEN PostDate AND RemoveDate ORDER BY PostDate DESC"; Link to comment https://forums.phpfreaks.com/topic/104422-solved-return-a-specified-range-from-database/#findComment-534572 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.