How do i echo my sql tables on an admin-page?
I already have an admin page and an sql table and an sql query class.php
This is the code i have in the query class:
public static function ShowTables(){
$sql = ("SELECT nfc_id, nfc_code, naam, email,DATE_FORMAT(registratie_datum,'%a, %d %M %Y, %H : %i') as registratie_datum,nfc_geregistreerd FROM ps_nfc_registratie ORDER BY nfc_id DESC");
$result = Db::getInstance()->executeS($sql);
}
So i got it to select my table and all the rows. Now i just need to know how i can echo this table to the .tpl file.
I was thinking something like this:
while($row = $result){
echo '<small>'.$row['naam'].'</small>';
}
But that issnt working and now im wondering if i should put something like this in the controller or/and the .tpl file.
I am new to prestashop, i got something like this to work outside of prestashop, but it seems like that code is not at all useable in prestashop:
function __construct($connection){
try {
$sql = $connection->conn->query("SET lc_time_names = 'nl_NL'");
$sql = $connection->conn->query("SELECT titel, ondertitel,DATE_FORMAT(datum,'%a, %d %M %Y, %H : %i') as datum,inhoud FROM blog WHERE state=1 ORDER BY id DESC");
while($row = $sql->fetch()){
echo '<div id="blogwrapper2">';
echo '<h1 id="blogtitel">'.$row['titel'].'</h1>';
echo '<small id="ondertitel">'.$row['ondertitel']." ".'</small>'.'-'." ";
echo '<small id="ondertitel">'.$row['datum'].'</small>';
echo '<p class="inhoud">'.$row['inhoud'].'</p>';
echo '</div>';
}
}catch(PDOException $e) {
echo $e->getMessage();
}
}