I have a working pagination script, it displays the data with few issues.
However, the issue I'm having is trying to get my data to enclose it in quotes if it's not null.
This is the part of my pagination script:
//This function shows the data
public function display()
{
if(date('Y-m-d') == date('Y-m-d', $this->airdate)) $dateFormat = 'g:ia';
elseif(date('Y') == date('Y', $this->airdate)) $dateFormat = 'F jS - g:ia';
else $dateFormat = 'F jS, Y - g:ia';
echo '<tr>'."\n".
' <td><strong>'.$this->program.'</strong></td>'."\n".
' <td>showing on '.$this->channel.'</td>'."\n".
' <td>'.date($dateFormat, $this->airdate).'</td>'."\n".
' <td><b>'.$this->episode.'</b></td>'. "\n".
' <td>'.$this->setReminder.'</td>'."\n".
'</tr>'."\n";
}
However, it's the $this->episode. part which I'm having trouble with.
The data renders correctly:
Episode Name
<null>
Episode Name 2
but I would like it to be like this:
"Episode Name"
<null>
"Episode Name 2"
I tried:
echo '<tr>'."\n".
' <td><strong>'.$this->program.'</strong></td>'."\n".
' <td>showing on '.$this->channel.'</td>'."\n".
' <td>'.date($dateFormat, $this->airdate).'</td>'."\n".
' <td><b>"'.$this->episode.'"</b></td>'. "\n".
' <td>'.$this->setReminder.'</td>'."\n".
'</tr>'."\n";
}
but the formatting came out as:
"Episode Name"
"<null>"
"Episode Name 2"
which wasn't how I expected it to turnout.
I'm not sure what the right solution is - is ifelse the best one, and if so what code would you recommend for this problem?