By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,447 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

Users who are free using php+mysql

P: 8
Hello,
Iam not well good in php,so please help.
I have to find out, from a set of users having events,the users who are free in the next 2 weeks.In the events table we have startdate and enddate of each event in the DATETIME format.
So with that data,i have find out whenever the users are free in the next 2 weeks.
Thanks in Advance.Please help
Feb 26 '08 #1
Share this Question
Share on Google+
7 Replies


P: 11
vashafnas-
can you show me what the date format looks like for the startdate and enddate fields?
-odobo


Hello,
Iam not well good in php,so please help.
I have to find out, from a set of users having events,the users who are free in the next 2 weeks.In the events table we have startdate and enddate of each event in the DATETIME format.
So with that data,i have find out whenever the users are free in the next 2 weeks.
Thanks in Advance.Please help
Feb 26 '08 #2

P: 8
vashafnas-
can you show me what the date format looks like for the startdate and enddate fields?
-odobo
Thanks for your reply.The date format is like 2008-02-29 12:30:00 in database
Feb 26 '08 #3

P: 8
Thanks for your reply.The date format is like 2008-02-29 12:30:00 in database
Please reply.I need help.Its urgent...
Feb 26 '08 #4

P: 11
try something like this
[PHP]/**
*returns a value that determines weather the user is still within a trial period
*@param string $EndDate the date the users trial ends
*@access public
*@return true if the end date is less than the time called
*/
function IsUserStillFree($EndDate)//2008-02-29 12:30:00
{
$cd=getdate();
$d=explode(" ",$EndDate);
$_date = explode("-",$d[0]);
$_time = explode(":",$d[1]);
$dateend=mktime(floor($_time[0]),floor($_time[1]),floor($_time[2]),floor($_date[1]),floor($_date[2]),floor($_date[0]),-1);
$today=mktime($cd[hours],$cd[minutes],0,$cd[mon],$cd[mday],$cd[year],-1);
return $today>$dateend;
}[/PHP]

Please reply.I need help.Its urgent...
Feb 26 '08 #5

P: 11
vashafnas -
well it's well past my bedtime.. I will be on tomorrow about 12 hrs from now..
hope that what i posted helps.
-odobo
Feb 26 '08 #6

P: 8
vashafnas -
well it's well past my bedtime.. I will be on tomorrow about 12 hrs from now..
hope that what i posted helps.
-odobo
Yaa..Thank u verymuch for ur help...
Feb 27 '08 #7

P: 11
no problem vashafnas.
Does that answer your question?
-odobo

Yaa..Thank u verymuch for ur help...
Feb 28 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.