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

Ask A Question

Stats

  • Questions 279k
  • Answers 279k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Thinking Sphinx relies on associations in model. In common situations… May 13, 2026 at 3:30 pm
  • Editorial Team
    Editorial Team added an answer Try nm -- this tool is there for just this… May 13, 2026 at 3:30 pm
  • Editorial Team
    Editorial Team added an answer These docs imply that you have to synchronize on the… May 13, 2026 at 3:30 pm

Related Questions

We have a DLL that monitors changes in status and looks for events from
Background I have a few scripts that run as part of my build process
I am hitting a strange problem in relation to equals on an object transported
I'm working on my first java struts2 webapp and want to be able to
I have the following use case: There's a class called Template and with that

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.