query a mysql table for rows that have the same month value and store as a php array for later use displaying them on a calendar -


the subject sums up, working on calendar in php client should pull events table , display them in appropriate cells.

the calendar table working no prob, trying avoid making separate db call each day of month.

i trying figure out way store results in array of arrays first, calendar created, each day has event(s) display portion of data there.

it's conceptual problem having , can't seem solve it.

also, not sure if it's possible.

any appreciated.

thanks.

for example:

select day, title, desc month = $month , year = $year order day asc 

and output without hitting db 31 times:

day1. title / desc   day2. title / desc <br> title / desc   day3.  title / desc 

you can 1 query events in mounth,

like write

 select day, title, desc mytable  month = $month , year = $year order day asc 

and in foreach loop on results, store in array like

while ($row = mysql_fetch_array($result, mysql_assoc)) {     $events[$row['day']][] = $row; } 

so in end of loop have array $events, every entry contain array of events in day.

like $events[1], $events[2] ....


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -