Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] pear db, tworzenie prostego interfejsu użytkownika
jessica99
post 11.07.2007, 13:57:05
Post #1





Grupa: Zarejestrowani
Postów: 36
Pomógł: 0
Dołączył: 14.12.2006
Skąd: Warszawa/Mrozy

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


mam następujący problem, nie wiem co jest źle w tym skrypcie:
  1. <?php  
  2. // zaіadowanie biblioteki PEAR DB
  3. require_once 'DB.php';
  4. // klasa ogуlnego dostкpu do bazy danych
  5. class DbManager
  6. {  
  7. public $db;
  8.  
  9. // konstruktor - zestawienie poіączenia z bazą danych
  10. function __construct($connectionString)  
  11. {  
  12. $this->db = DB::connect($connectionString,
  13. USE_PERSISTENT_CONNECTIONS);
  14. if (DB::isError($this->db))  
  15.  trigger_error($this->db->getMessage(), E_USER_ERROR);
  16. $this->db->setFetchMode(DB_FETCHMODE_ASSOC);
  17. }  
  18. // zamkoсczenie poіączenia
  19. public function DbDisconnect()
  20. {  
  21. $this->db->disconnect();
  22. }
  23. public function DbQuery($queryString)  
  24. {  
  25. $result = $this->db->query($queryString);  
  26. if (DB::isError($result))  
  27.  trigger_error($result->getMessage(), E_USER_ERROR);
  28. return $result;  
  29. }
  30. // nakіadka na metodк getAll() biblioteki PEAR DB
  31. public function DbGetAll($queryString)
  32. {  
  33. $result = $this->db->getAll($queryString);
  34. if (DB::isError($result))  
  35.  trigger_error($result->getMessage(), E_USER_ERROR);
  36. return $result;  
  37. }
  38. // nakіadka na metodк getRow() biblioteki PEAR DB
  39. public function DbGetRow($queryString)
  40. {  
  41. $result = $this->db->getRow($queryString);
  42. if (DB::isError($result))
  43.  trigger_error($result->getMessage(), E_USER_ERROR);
  44. return $result;
  45. }  
  46. // nakіadka na metodк getOne() biblioteki PEAR DB
  47. public function DbGetOne($queryString)
  48. {  
  49. $result = $this->db->getOne($queryString);
  50. if (DB::isError($result))
  51.  trigger_error($result->getMessage(), E_USER_ERROR);
  52. return $result;
  53. }  
  54. // nakіadka na metodк escapeSimple()
  55. public function DbEscapeSimple($string)  
  56. {  
  57. return $string;  
  58. else
  59. return $this->db->escapeSimple($string);
  60. }  
  61.  
  62. }  
  63. ?>


po jego wykonaniu pojawia mi się następujący błąd:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in C:\xampp\htdocs\sklep\include\database.php on line 7


co powinnam w nim zmienić
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: 24.07.2025 - 23:40