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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.