<?php require_once(\"./DB/DB.php\"); class DataAccess { var $db, $result; function __construct() { $db_inf = new XMLConfig('config.xml'); $dsn = $db_inf->getDbtype().\"://\".$db_inf->getUser().\":\".$db_inf->getPassword().\"@\".$db_inf->getHost().\"/\".$db_inf->getDbname(); $this->db =& DB::connect($dsn); if (DB::isError($this->db)) { } $this->db->autoCommit(true); } function query($sql) { $this->result = $this->db->query($sql); if (DB::isError($this->result)) { return false; } else { return true; } } function fetchRow() { if ($this->result->fetchInto($row)) { return $row; } else { return false; } } } ?>
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:
<html> <body> <?php function handle_errors ($error, $message, $filename, $line) { exit; } ?> <?php require_once('./DB/DB.php'); $db = new DB(); $db->connect('mysql://localhost/internet_shop'); // ... ?> </table> </body> </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