rendered paste bodyglobal $gCms;
$db = &$gCms->db;
//add table headers
$output .= '
<table width="445">
<tr style="background-color:black;color:white;text-align:center;">
<td width="100"><strong>Air Date</strong></td>
<td width="280"><strong>Title</strong></td>
<td width="32"><strong>#</strong></td>
<td width="85"><strong>Screencaps</strong></td>
</tr>';
//the query
$q = "SELECT * FROM episodes ORDER BY Date DESC";
$dbresult = $db->Execute( $q );
//we didnt get any results lets spit out a error
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."<br/>";
}
//get one row at a time and add it to output
while ($dbresult && $onerow = $dbresult->FetchRow())
{
//these will be printed before form
$output .= '<tr>';
$output .= '<td class="eps">'. date('m/d/y',strtotime($onerow['Date'])) ."</td>";
$output .= '<td class="eps">'. $onerow['Title'] ."</td>";
$output .= '<td class="eps">'. $onerow['Episode_Number'] ."</td>";
$output .= '<td class="eps">'.(isset($onerow['Screencaps']) && $onerow['Screencaps'] != ''?'<a href="'.$onerow['Screencapsl'].'">Screencaps</a>':' ').'</td>';
$output .= "</tr>";
}
$output .= "</table>";
echo $output;