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 6332649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:18:17+00:00 2026-05-24T18:18:17+00:00

I’m new to using PDO and prepared statement so if I’m doing this blatantly

  • 0

I’m new to using PDO and prepared statement so if I’m doing this blatantly wrong please let me know 🙂

I have the following code:

$stmt = $this->_dbh->prepare( '(SELECT folder_id, "y" AS "has_access", access_type FROM groups_users AS gu LEFT JOIN folders_groups AS fg ON gu.group_id = fg.group_id WHERE user_id = :user_id)
                        UNION
                        (SELECT folder_id, has_access, access_type FROM folders_users WHERE user_id = :user_id AND has_access = :yes)' );
$stmt->bindValue( ':user_id', $this->_user_id, PDO::PARAM_INT );
$stmt->bindValue( ':yes', self::YES, PDO::PARAM_STR );
$stmt->execute();
$folders = $stmt->fetch( PDO::FETCH_ASSOC );

and if I do:

print_r($this->_dbh->errorInfo());                                   
print_r($folders);

$folders is FALSE and my errorInfo() returns:

Array ( [0] => 00000 [1] => [2] => )

Which from my understanding of it means there’s no errors. I tried replacing my :user_id and :yes with the values and I don’t get errors. The result is empty but my fetch call still returns false (which the documentation says that it failed) when I’m expecting an empty array.

Thanks for any help 🙂

  • 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-24T18:18:18+00:00Added an answer on May 24, 2026 at 6:18 pm

    A fetch call which returns false is not an error condition – it just means there’s no data to fetch. e.g. your query returned no data. What does $stmt->rowCount() return?

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
I want use html5's new tag to play a wav file (currently only supported
I'm looking for suggestions for debugging... If you view this site in Firefox or
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.