Por qué no manejas todo directamente de la query con un while? Algo así:
Código PHP:
echo '<table name="blablabla" id="blahblah">';
echo '<tr>';
echo '<th>ID</th><th>Titulo</th><th>Etc...</th>';
echo '</tr>';
while($res = mysql_fetch_assoc($data)) {
echo '<tr>';
echo "<th>{$res['id']}</th>";
echo "<th>{$res['titulo']}</th>";
echo "<th>Etc...</th>";
echo '</tr>';
}
echo '</table>';