This is the Error Message i get when i run the code :
ERRNO: 2
TEXT: require_once(BD.php) [ function.require-once]: failed to open stream: No such file or directory
LOCATION: C:\wamp\www\my web projects\tshirtshop\business\database_handler.php, line 8, at February 18, 2010, 8:50 pm
Showing backtrace:
require_once() # line 8, file: C:\wamp\www\my web projects\tshirtshop\business\database_handler.php
require_once("C:\wamp\www\my web projects\tshirtshop\business\database_handler...") # line 16, file: C:\wamp\www\my web projects\tshirtshop\index.php
I have to mention though that i have installed and configured the pear package correctly cause i have used it in other projects and never had a problem like this before.
Below is the code i use. I know you can help me guys.
Thanks in advance.
PHP Code:
<?php
require_once ('BD.php'); class DatabaseHandler { private static $_mHandler; private function __construct() { } private static function GetHandler() { if(!isset(self::$_mHandler)) { try { self::$_mHandler = BD::connect(DSN, FALSE); self::$_mHandler->setErrorHandling(PEAR_ERROR_TRIGGER); self::$_mHandler->setErrorHandling(PEAR_ERROR_DIE); self::$_mHandler->setFetchMode(DB_FETCHMODE_ASSOC); if(DB::isError(self::$_mHandler)) { throw new Exception("Could not create mHandler"); } } catch (Exception $e) { self::Close(); trigger_error($e->getMessage()); } } return self::$_mHandler; } public static function Close() { self::$_mHandler = null; } public static function Execute($sqlQuery, $params = null) { try { $database_handler = self::GetHandler(); $statement_handler = $database_handler->prepare($sqlQuery); $statement_handler->execute($params); } catch(Exception $e) { self::Close(); trigger_error($e->getMessage()); } } public static function GetAll($sqlQuery, $params = null, $fetchStyle = DB_FETCHMODE_ASSOC) { $result = null; try { $database_handler = self::GetHandler(); $statement_handler = $database_handler->prepare($sqlQuery); $statement_handler->execute($statement_handler); $result = $statement_handler->fetchAll($fetchStyle); } catch (Exception $e) { self::Close(); trigger_error($e->getMessage()); } return $result; } } ?>
Last edited by chrishirst; 02-18-2010 at 02:29 PM..
|