-3

I am having problem debugging my code. I am following a tutorial to build a calendar app. But the above error is being displayed each time I attempt to run it. Therefore I need help to spot out the error.

The following are the lines of the code:

public function displayEvent($id)
{
    /*
    *Make sure an ID was passed
    */
    if ( empty($id) ) { return NULL; }

    /*
    *Make sure an ID is an integer
    */
    $id = preg_replace('/[^0-9]/', '', $id);

    /*
    *Load the event data from the DB
    */
    $event = $this->_loadEventById($id);

    /*
    *Generate strings for the date, start, and end time
    */
    $ts = strtotime($event->start);
    $date = date('F d, Y' $ts);
    $start = date('g:ia', $ts);
    $end = date('g:ia', strtotime($event->end));

    /*
    *Generate and return the markup
    */
    return "<h2>$event->title</h2>"
        . "\n\t<p class=\"dates\">$date, $start&mdash;$end</p>"
        . "\n\t<p>$event->description</p>";
}

The code is much longer but for the sake of brevity and not having to burden anyone with long code I have copied out only the function where the error is coming from.

What is going wrong?

showdev
  • 28,454
  • 37
  • 55
  • 73
  • 1
    You could have pointed out which line 261 was, a simple search of `$ts` reveals the issue though. – chris85 Oct 06 '16 at 00:15
  • $date = date('F d, Y' $ts); is missing a comma $date = date('F d, Y', $ts); –  Oct 06 '16 at 00:20

1 Answers1

3

Put a , before the variable.

$date = date('F d, Y', $ts);
Irvin
  • 830
  • 5
  • 13