nezbo Posted February 13, 2009 Share Posted February 13, 2009 please help me get this to work i have a hour, min, day, month, and year field my database and i want to have it only showing less that mktime() but it is not bringing anythin beck? $getManagerInfo = @mysql_query("SELECT * FROM oncall_staff, person WHERE person.CallID = oncall_staff.userID AND UNIX_TIMESTAMP('oncall_staff.StartDateYears-oncall_staff.StartDateMonths-oncall_staff.StartDateDays oncall_staff.StartDateHours:oncall_staff.StartDateMins:00') < '" . mktime() . "' AND oncall_staff.valid = 0"); while ($getManagerInfo1 = @mysql_fetch_array($getManagerInfo)) { Cheers, Nezbo Link to comment https://forums.phpfreaks.com/topic/145073-unix_timestamp-help/ Share on other sites More sharing options...
rhodesa Posted February 13, 2009 Share Posted February 13, 2009 #1 Why are your year/month/day/etc in separate fields? Why aren't you just using one DATETIME field? #2 Try this: SELECT * FROM oncall_staff, person WHERE person.CallID = oncall_staff.userID AND UNIX_TIMESTAMP(CONCAT(oncall_staff.StartDateYears,'-',oncall_staff.StartDateMonths,'-',oncall_staff.StartDateDays,' ',oncall_staff.StartDateHours,':',oncall_staff.StartDateMins,':00')) < '" . time() . "' AND oncall_staff.valid = 0"); Link to comment https://forums.phpfreaks.com/topic/145073-unix_timestamp-help/#findComment-761255 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.