I want to create a new link/page in the backoffice left side menu. So i figuered i will create a controller.
controllers/admin/AdminPageController.php:
<?php
class AdminPageController extends AdminController
{
public function initContent()
{
parent::initContent();
$smarty = $this->context->smarty;
$smarty->assign('testpage', 'testpage');
}
}
?>
admin\themes\default\template\controllers\page\content.tpl
$con=mysqli_connect("localhost","root","password","prestashop");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM ps_customer");
echo "<table border='1'>
<tr>
<th>company</th>
<th>email</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['company'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
At BackOffice -> Administration -> Menus -> i created the menu to my controller with Home as parent.
according to this, it should show the company & email column from the ps_customer table.
However, when i open that test page, i see this:
company email "; while($row = mysqli_fetch_array($result)) { echo ""; echo "" . $row['company'] . ""; echo "" . $row['email'] . ""; echo ""; } echo ""; mysqli_close($con); ?>
How come it's not display the table? what am i doing wrong?
Thanx