Jump to content

Date


Recommended Posts

Hi,

 

I have a query that shows all appointments of a chosen day using the following format:

 

$eventid=2007-05-21

 

WHERE starttime LIKE '".$eventid."%'

 

I have a calendar and am trying to make it show all records for the selected month, or display all records from a specific day if a day is selected from the calendar.

 

So far I have it where I can show records from specific day, but want selected months records as default.

 

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/51002-date/
Share on other sites

Hi,

 

Its stored as "datetime"

 

Im looking more for an if statment I think.

 

if(isset($eventid)){

$eventid = 2007-05-21

}else{

$eventid = selected_month

}

 

Not sure really, trying to keep it simple.

 

Just not sure how to grab all records = to 5th month or 6th month. The variable passed is "2007-05-21"

 

maybe use explode and the date parts?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/51002-date/#findComment-250963
Share on other sites

Hmm

 

Tried a few ways, no success:

 

$eventid=2007-05-21

 

$sql = mysql_query("SELECT id, firstname, lastname, phone, cellphone, email, MONTH(starttime) -> 2, finishtime, event FROM calendar WHERE starttime LIKE '".$eventid."%' ORDER BY starttime ASC");

 

Trying to pull all records for the 5th month.

 

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/51002-date/#findComment-250995
Share on other sites

That was from the manual

 

I have tried a few ways with no success. Brings back no matches:

 

$sql = mysql_query("SELECT id, firstname, lastname, phone, cellphone, email, starttime, finishtime, event FROM calendar WHERE MONTH(starttime) LIKE 'MONTH(".$eventid.")%'");

 

Must be close, all makes sence.

 

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/51002-date/#findComment-251008
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.