Mi código que genera la tabla es:
Código PHP:
private function getTable($sql,$tipo)
{
$table = null;
$registro = null;
$result = $this->db->query($sql);
if (!$result)
{
return "gettablefail";
}
else
{
$table = "<table id='tabla'>";
$table .= "\n";
$table .= "<tr><th><input type='checkbox'/></th><th>De</th><th>Asunto</th><th>Recibido</th></tr>";
while ($row = $result->fetch_array())
{
if ($row['tipo'] == $tipo)
{
$row2 = "<tr><td><input type='checkbox'/></td><td>$row[De]</td><td>$row[Asunto]</td><td>$row[Recibido]</td></tr>"."\r\n";
}
if ($row['nuevo'] == 'si')
{
$row2 = "<tr class='nuevo' ><td><input type='checkbox'/></td><td>$row[De]</td><td>$row[Asunto]</td><td>$row[Recibido]</td></tr>"."\r\n";
}
$table .= $row2;
}
$table .= "</table>";
}
return $table;
}