Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MYSQL][Smarty] niewyświetla
-k1ilo-
post
Post #1





Goście







Witam mam problem mam klasę
  1. <?php
  2. class news
  3. {
  4. private $Baza;
  5. public function __construct() {
  6. $this->Baza = mysql_connect("localhost", "user", "pass")
  7. or die('connect_error'.mysql_error());
  8. mysql_select_db('dbname')or die('database_error'.mysql_error());
  9. }
  10.  
  11. public function wyswietl($ile) {
  12. $query = 'SELECT id, tytul, tresc, data FROM news ORDER BY id DESC LIMIT 0, "'.$ile.'"';
  13. mysql_query($query);
  14. $aNews = array();
  15. while($r = mysql_fetch_array($query)) {
  16. $aNews[] = $r;
  17. }
  18. return $aNews;
  19. }
  20. }
  21. ?>

i teraz nie potrafię wyświetlić wyników
  1. <?php
  2. require './news.php';
  3.  
  4. $smarty = new blog;
  5.  
  6. $a = new news;
  7. $a -> wyswietl(1);
  8.  
  9. $smarty -> assign('news', $a -> wyswietl());
  10. $smarty -> display('news.tpl');
  11. ?>


Pewnie coś źle robię tylko nie mam już pomysłu co.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 29.12.2025 - 16:40