|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
My calendar page is suppose to list the events for each month, ie
January 1 - Event name However it is only showing me the month. My guess is that it is not showing the the other information because of my query. I have a date column and I am using the between function in my where clause. First time I am using date column type and between function. However I have gone over the code, particulary the query and can't fiqure out what is wrong. Any help would be greatly appreciated. Code in attached file
__________________
CHornJr "One day I'll know what I am doing" ![]() My Blog Suanhacky Lodge #49 Rebel Squadrons |
|
#2
|
||||
|
||||
|
Do you know that it's copacetic to use BETWEEN with dates? For kicks, expand your query to use >= and <= to limit the range. If that works, then it's probably a matter of BETWEEN not evaluating the date expression correctly.
|
|
#3
|
|||
|
|||
|
There is nothing wrong with using BETWEEN as long as you use it correctly.
mysql_query("SELECT * FROM calendar WHERE start_date BETWEEN '$currentdate' AND 'endofmonth' change that to mysql_query("SELECT * FROM calendar WHERE start_date BETWEEN $currentdate AND $endofmonth And it should work then. |
|
#4
|
||||
|
||||
|
I found out what was wrong. I echoed out currentdate and endofmonth variables again and I then remebered after viewing it that getdate() months come back as 1 not 01 (in the case of January). So I added a switch statement that has Case 10,11, 12 keep as is, if month equal to 1-9 make month= 01-09
PHP Code:
I havn't finished fully testing all of it yet, but so far seems to be working ok now Quote:
if you put php variables inside a select statement with out them being surrounded by single quotes you WILL get a parse error because MySQL thinks they are a string instead of variables. (Look, I actually knew something ahead of time, WOW ) |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Calendar Page not properly showing data (date column and/or between suspected fellon |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|