Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Pear problem...can anyone help???
Old 02-18-2010, 01:59 PM Pear problem...can anyone help???
Junior Talker

Posts: 3
Trades: 0
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(DSNFALSE);
                
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..
kirk86 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-18-2010, 02:32 PM Re: Pear problem...can anyone help???
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Set the correct path for BD.php


BTW make sure the case is correct for if and when you host it, because while windows is case insensitive *nix is NOT and BD.php will not be the same as bd.php
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-19-2010, 06:51 AM Re: Pear problem...can anyone help???
Junior Talker

Posts: 3
Trades: 0
The path to pear package is correctly set, i have configured it from php.ini and set the include_path to the destination of my pear package. Any other ideas why this is happening???


Thanks!!!
kirk86 is offline
Reply With Quote
View Public Profile
 
Old 02-19-2010, 06:57 AM Re: Pear problem...can anyone help???
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by kirk86 View Post
The path to pear package is correctly set, i have configured it from php.ini and set the include_path to the destination of my pear package.
Maybe, BUT

THIS;
Quote:
failed to open stream: No such file or directory
Says the BD.php IS NOT where you indicate it to be in the "require_once(BD.php)" function call.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-19-2010, 07:08 AM Re: Pear problem...can anyone help???
Junior Talker

Posts: 3
Trades: 0
I have also tried to include the full path to DB.php like this require_once('C:\xampp\bin\php\php5.2.6\PEAR');

but still nothing the problem remains and i still got the same error message.
kirk86 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Pear problem...can anyone help???
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15848 seconds with 12 queries