[Solved] Display multiple rows on calendar Question |
Hi All,
I would like to know how I would be able to do this. Lets say I have two rows on database table that has the same date example: 2015 - 12 - 25 As shown in attached image. How could I get my function to return multiple rows if date is the same? Currently as shown on calendar image on 2015-12-25 I can only display one row. PHP Code: public function get_calendar_data($year, $month) { Controller Note: model functions on controller just for testing once all working properly will move to proper model. PHP Code: <?php
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
12-19-2015, 04:03 AM
(This post was last modified: 12-19-2015, 04:57 AM by Happy Camper. Edit Reason: Fixing typo )
Hello,
The way I did this in the past was to have each cell in the calendar contain an unordered list with a list item for each event happening on a particular day. So assuming there were 2 events happening on a particular day the cells data would be like this PHP Code: $cell_data ='<ul><li>' .$event1. '</li><li>' .$event2. '</li></ul>'; Where $cell_data is constructed within a foreach loop You will need an extra function in your model to return all events happening on a given day which the previously mentioned foreach will loop through. Hope this helps!
(12-19-2015, 04:03 AM)Happy Camper Wrote: Hello, But what I can not seem to make it work with my get function need example.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
>>> But what I can not seem to make it work with my get function need example.
Try adding this extra line: Quote:public function get_calendar_data($year, $month) { If that doesn't work then echo last_query() and add " WHERE calendar_id > 0"
(12-19-2015, 08:01 PM)John_Betong Wrote: >>> But what I can not seem to make it work with my get function need example. Been searching the web and found that this code below works fine now PHP Code: public function get_events($year, $month) { I have attached image proof.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
|
Welcome Guest, Not a member yet? Register Sign In |