Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Bład z tablicami w szablonie
Joachim Peters
post 3.08.2006, 20:02:08
Post #1





Grupa: Zarejestrowani
Postów: 196
Pomógł: 2
Dołączył: 1.03.2006

Ostrzeżenie: (0%)
-----


Witam,

Pojawił mi się taki błąd:
Array Array

kod wygląda następująco:
  1. <?php
  2.  
  3. include('includes/functions_template.php');
  4.  
  5. class db 
  6. {
  7.  var $result;
  8.  var $sql_queries = 0;
  9.  
  10.  function connect() 
  11.  {
  12.  require('config.php');
  13.  }
  14.  
  15.  function query($sql) 
  16.  {
  17. $this->result = @mysql_query($sql); 
  18. $this->sql_queries++;
  19. return $this->result;
  20.  }
  21.  
  22.  function fetch($result) 
  23.  {
  24. return mysql_fetch_array($result);
  25.  } 
  26.  
  27.  function show_query() 
  28.  {
  29. print $this->sql_queries;
  30.  }
  31. }
  32.  
  33. $db = new db();
  34. $db->connect();
  35.  
  36. define('CONFIG_TABLE', 'php_config');
  37.  
  38. $sql = "SELECT * FROM " . CONFIG_TABLE ."";
  39. $result = $db->query($sql);
  40. $row = $db->fetch($result);
  41.  
  42. $template->assign_body('index.tpl', 'demo');
  43.  
  44. $template->assign_vars( array(
  45. 'SITE_NAME' => $row['site_name'],
  46. 'DESC' => $row['desc'],
  47. 'META' => $row['meta'],
  48. 'WIDTH' => $row['width'],
  49. ));
  50.  
  51. define('PAGE_TABLE', 'php_page');
  52.  
  53. $sql = "SELECT * FROM " . PAGE_TABLE . "";
  54. $result = $db->query($sql);
  55. while($row = $db->fetch($result))
  56. {
  57. $template->assign_loop_vars('page', array(
  58. 'NAME' => $row['page_title']
  59. ));
  60. }
  61.  
  62. $template->display_body();
  63.  
  64. ?>

korzysztam z szablony skórek JustIT, w bazie jest wszystko ok.

Ten post edytował d@ro 4.08.2006, 09:51:02
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 29.06.2025 - 13:41