Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 533843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:33:02+00:00 2026-05-13T09:33:02+00:00

I have a class that is getting called and for some reason one of

  • 0

I have a class that is getting called and for some reason one of the functions I have is being found, but the other one is not. Here is my code:

<?php


namespace LMVC\Database;

class PDO
{
private static $instance = NULL;

public static function setup($dsn, $username, $password)
{
    try {
        self::$instance = new \PDO($dsn, $username, $password);
    }
    catch(PDOException $e) {
        throw new Exception("Error: " . $e->getMessage());
    }
}

public static function getInstance()
{
    if(self::$instance === NULL) {
        throw new Exception("Database is not instantiated");
    }

    return self::$instance;
}

public function query($sql)
{
    if(self::$instance === NULL) {
        throw new Exception("Database is not instantiated");
    }

    try {
        return self::$instance->query($sql);
    }
    catch(PDOException $e) {
        throw new Exception("Error: " . $e->getMessage());
    }
}

public function fetchAll($stmt)
{
    if(self::$instance === NULL) {
        throw new Exception("Database is not instantiated");
    }

    try {
        return self::$instance->fetchAll($stmt);
    }
    catch(PDOException $e) {
        throw new Exception("Error: " . $e->getMessage());
    }
}

public function prepare()
{

}

public function quote()
{

}
}

All of the functions except fetchAll are able to be found, but fetchAll is not. I can’t seem to add functions that exist either. When I change the name of fetchAll to something else it can’t find the functoin I rename it to. Also when I get rid of the functions that are able to be found like quote, query, and prepare, php is still able to find them, I tested using var_dump with function exists. I have tried restarting apache, restarting windows 7. I am using php 5.3.1.

Any other ideas on how to debug? I can’t seem to find out how to get the error log to work by editing my php.ini file either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:33:02+00:00Added an answer on May 13, 2026 at 9:33 am

    You are probably implementing PHP’s prebuilt PDO Object. Have you tried instantiating your object directly with the namespace path? e.g.

    $foo = new LMVC\Database\PDO;
    

    Otherwise, PHP may be instantiating its own object named PDO, which is in the root namespace.

    EDIT FOR MORE INFO

    If you are including the file that defines this class, and you do not specify the namespace in the file which instantiates this class, then PHP will only consider the declared namespace to be in effect during the execution of the file which defines said class. Outside of that include file, it will use namespace fallback to declare the global object.

    You should, since PDO is an existing global object, rename your class (myPDO, perhaps?) in order to avoid this sort of confusion in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that map objects to objects, but unlike dictionary it maps
I have class method that returns a list of employees that I can iterate
I have a class that I want to use to store properties for another
I have a class that I wish to expose as a remote service using
I have a class that looks like this public class SomeClass { public SomeChildClass[]
I have a class that creates several IDisposable objects, all of these objects are
I have a class that encapsulates tcp socket communications with a server. For each
I have a class that processes a 2 xml files and produces a text
I have a class that utilizes a directory swap method for the Environment.CurrentDirectory. The
I have a class that has a Generic type G In my class model

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.