televi Posted November 3, 2016 Share Posted November 3, 2016 (edited) 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 Edited November 3, 2016 by televi (see edit history) Link to comment Share on other sites More sharing options...
televi Posted November 7, 2016 Author Share Posted November 7, 2016 Bump Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now