elePHPant

index.php

Nov 8th, 2021
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2. require_once ('../smarty/libs/Smarty.class.php');
  3. require_once ('../cls/GuestBook.class.php');
  4. require_once ('../conn.php');
  5. $smarty = new Smarty;
  6. $smarty->template_dir = '/web/templates/';
  7. $smarty->compile_dir = '/web/templates_c/';
  8. $smarty->config_dir = '/web/configs/';
  9. $smarty->cache_dir = '/web/cache/';
  10.  
  11. $query = $conn->query("SELECT * FROM `gb`");  // не надо использовать звездочку
  12. $row = $query->fetchAll(PDO::FETCH_ASSOC);                // получите сразу весь массив
  13.  
  14. $smarty->assign('row', $row);
  15. $smarty->assign('title', "Main page");
  16. $smarty->display('templates/index.tpl');
  17.  
Advertisement
Add Comment
Please, Sign In to add comment