Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: pear:db, wamp server - kod przestaje sie wykonywac
Forum PHP.pl > Forum > Przedszkole
Gość_Sopel
  1. <?php
  2. require_once(&#092;"./DB/DB.php\");
  3.  
  4. class DataAccess {
  5. var $db, $result;
  6. function __construct() {
  7. $db_inf = new XMLConfig('config.xml');
  8. $dsn = $db_inf->getDbtype().&#092;"://\".$db_inf->getUser().\":\".$db_inf->getPassword().\"@\".$db_inf->getHost().\"/\".$db_inf->getDbname();
  9. $this->db =& DB::connect($dsn);
  10. if (DB::isError($this->db)) {
  11. die ($this->db->getMessage());
  12. }
  13. $this->db->autoCommit(true);
  14. }
  15. function query($sql) {
  16. $this->result = $this->db->query($sql);
  17. if (DB::isError($this->result)) {
  18. return false;
  19. } else {
  20. return true;
  21. }
  22. }
  23. function fetchRow() {
  24. if ($this->result->fetchInto($row)) {
  25. return $row;
  26. } else {
  27. return false;
  28. }
  29. }
  30. }
  31. ?>


klasa do obslugi polaczenia z baza danych. dane z pliku xml pobierane sa prawidlowo i $dsn jest ustawiony dobrze.. problem polega na tym, ze skrypt przestaje sie wykonywac po $this->db =& DB::connect($dsn);.. probowalem kilku rzeczy i nic...

znalazlem w google taki przyklad:
  1. <html>
  2. <body>
  3. <?php
  4.  function handle_errors ($error, $message, $filename, $line) {
  5.  ob_end_clean( );
  6.  echo &#092;"<b>$message</b> in line $line of <i>$filename</i></body></html>\";
  7.  exit;
  8.  }
  9.  set_error_handler('handle_errors');
  10.  ob_start( );
  11. ?>
  12.  
  13. <?php
  14.  require_once('./DB/DB.php');
  15.  $db = new DB();
  16.  $db->connect('mysql://localhost/internet_shop');
  17.  if (DB::iserror($db)) die($db->getMessage( ));
  18.  // ...
  19. ?>
  20. </table>
  21. </body>
  22. </html>

no i wyswietlil mi sie blad: Assigning the return value of new by reference is deprecated in line 310 of c:\wamp\www\Sklep\DB\DB.php..

pomozcie prosze
Gość_Sopel
jakby ktos mial taki sam problem: byl to konflikt pear i db.
pomyslalem ze cos jest nie tak z serwerem wamp, wiec zainstalowalem sam korzystajac ze strony http://www.ricocheting.com/server/

potem zaczelo jako tako dzialac smile.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.