Jump to content

UNIX_TIMESTAMP() help


nezbo

Recommended Posts

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

#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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.