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

  • SEARCH
  • Home
  • 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 103473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:07:46+00:00 2026-05-11T01:07:46+00:00

I am updating some code from the old mysql_* functions to PDO. It connects

  • 0

I am updating some code from the old mysql_* functions to PDO. It connects without a problem, runs the query without a problem, but the resultset is empty. PDO::query() is supposed to return a PDOStatement object, yet I am getting true in return. No errors are reported.

Here is my code:

 try {     $DB = new PDO('mysql:host=localhost;dbname=dbname', 'user', 'pass');     $stmt = $DB->prepare('SELECT * FROM report_clientinfo');     $stmt->execute(); }catch(PDOException $e) {     echo $e->getMessage() . '\n'; }   echo gettype($stmt) . '\n'; if ($stmt) echo 'true\n'; else echo 'false\n';  $resultset = $stmt->fetchAll();  if(empty($resultset)) {     exit('ERROR: getClientInfo query failed.'); }  $DB = null;  print_r($resultset);  

The output I am seeing is:

object true ERROR: getClientInfo query failed.

Any ideas why it is not returning any results?

  • 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. 2026-05-11T01:07:47+00:00Added an answer on May 11, 2026 at 1:07 am
    object   true   ERROR: getClientInfo query failed. 

    It looks to me like your PDOStatement $stmt variable is in fact reported to be an object, not ‘true‘. The code then prints ‘true‘ when it sees that $stmt is non-null, which it is, because it’s an object.

    I recommend that you check the return value from $stmt->execute(). You might have an SQL error. For example, if you misspelled the table name, or the table doesn’t exist in the database ‘dbname‘ that you connected to, or the user you login as doesn’t have privilege to query that table.

    Also check $stmt->errorInfo() to get more details on any error that occurred.

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

Sidebar

Related Questions

I'm updating some legacy code from the old 3.0 version of the C# Facebook
I'm updating some old code to grab some binary data from a URL instead
I'm updating some old code that has several POD structs that were getting zero'd
I'm updating some of our old code to use C++11 features in place of
Ahoy! I've been looking into updating some old test code in an attempt to
So I'm working on updating a large project from really old C++/Carbon code, and
I'm updating some old code, and to make more room in a toolbar, I'm
I am updating some old code of mine and decided to change everything XML
So I managed to get some code rolling for updating the AD from an
I have encountered a weird situation while updating/upgrading some legacy code. I have a

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.