Jump to content
FooKelvin

PHP Course Event Monthly View

Recommended Posts

But the problem is, when I hard code the query with 

WHERE FiscalYear ='FY16'

The table will only show the course name, if there is an event happen in FY16. Meaning it will not show the full list of courses. =(

Share this post


Link to post
Share on other sites

Don't put FiscalYear condition in the WHERE clause, put it in the table join condition

LEFT JOIN eventtbl e ON c.cid = e.cid AND e.FiscalYear = 'FY16'

Share this post


Link to post
Share on other sites

Hi Barand,

 

Sorry for disturbing you.

 

I put in end date to make the table more details.

but the layout seem to be incorrect.

The attachment included 2 start date end 2 end date, but they are like combine it together.

 

post-179514-0-67773500-1447384723_thumb.jpg

 

11/03/15-11/04/15  <- is a complete start and end

11/23/15-11/24/15  <- is a complete start and end

Share this post


Link to post
Share on other sites

try applying this to your "td" css

white-space: nowrap;

post-3105-0-82970200-1447415998_thumb.png

Edited by Barand

Share this post


Link to post
Share on other sites

I added a line end date after the start date.

    if ($sd){
        $data[$cid]['events'][$m][] = date_format(($sd), 'm/d/y'); //m/d/y
    }
    if ($ed){
         $data[$cid]['events'][$m][] = date_format(($ed), 'm/d/y'); //m/d/y
    }

Share this post


Link to post
Share on other sites

You are adding each date as a separate item. You need to add the date pairs as one item then join the items using "<br>"

if ($sd){
        $item = date_format(($sd), 'm/d/y'); //m/d/y
    }
    if ($ed){
         $item .= '-' . date_format(($ed), 'm/d/y'); //m/d/y
    }
    $data[$cid]['events'][$m][]  = $item;
}

Share this post


Link to post
Share on other sites

Thanks Barand. I have change the line of code as above. it's working!

if ($sd){
        $item = date_format(($sd), 'm/d/y'); //m/d/y
    }
    if ($ed){
         $item .= '-' . date_format(($ed), 'm/d/y'); //m/d/y
         $data[$cid]['events'][$m][]  = $item;       //<--- Move to this line
    }

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.