We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to read out a table from MySQL database the proper way

Hi.

How can I read a table the right way in Phalcon (PHP 5.6) from a xampp database? I have set up the connection.

This would be the RAW PHP version of what I'm looking for:

$database = "SELECT * FROM database";
$result = mysqli_query($mysqli, $database); 
echo "<table cellspacing='0' cellpadding='0'>";
echo "<tr valign='middle' id='toprow'><td width='30%'>Publication Date</td><td>Article</td><td></td></tr>";

while ($row = mysqli_fetch_array($result)){ 
    echo "<tr>";
    echo ("<td> $row[date] </td>");
    echo ("<td> $row[title] </td>");
    echo "<td><a href='edit.php?id=$row[id]'>Edit</a></td>";
    echo ("</tr>");
} 
echo "</table>";

Thank you very much for aiding an absolute noob on their way to becoming a PHP Phalcon developer!

P.S.: I can try to do it with injection-safe versions. All I need to know is the MVC way of doing it.