SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: foreach issue

  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    foreach issue

    Hi,

    I have this iCal jQuery Calendar, and a MySQL database. I have used PHP to populate it. Currently, it shows events in the future on the calendar, however I'd like it to also show past events. The variable for past events is $history. I've tried foreach(array_merge($history, $events) as $event) but it does not work, the calendar just disappears.

    This is the documentation for the calendar: https://github.com/MrHus/jquery-monthly-ical/tree/

    And this is the code I have, excluding JavaScript:

    Code:
    							<?php 
    							$dates = array();
    
    							// build an array with that data
    							foreach($events as $event)
    							  $dates[] = (object)array(
    								 'date'  => date('Y-m-d', strtotime($event->date)),
    								 'title' => $event->title,
    								 'desc'  => sprintf('<a href="%s/index.php/events/get_event?id=%s">Click for more info and to sign up.</a>', SITE_URL, $event->id),
    							  );
    
    							?>

  2. #2
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,612
    Mentioned
    83 Post(s)
    Tagged
    1 Thread(s)
    Hi HighFlyer,

    I've moved your post as it is better suited for the PHP forum.

    Regards,
    Steve

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •