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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:41:00+00:00 2026-06-14T07:41:00+00:00

I am trying to select a user id ( uID ) just to check

  • 0

I am trying to select a user id (uID) just to check if it exists… I am getting stuck at just the most basic select statement…

I’ve searched and tried different people’s code but either my code always returns true (if i dont use fetch) or it says that it is not an object and i cant not use fetch….

$sql = 'SELECT uID FROM ldc_user_details where uID=3';
$q = $this->db->prepare($sql);
$i=$q->execute();

     foreach ($i->fetch() as $key => $val){
      echo 'key='.$key." val =".$val;
     }

ERROR: Call to a member function fetch() on a non-object in /home/pdwdev/public_html/ldc_main.php
  • 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-06-14T07:41:01+00:00Added an answer on June 14, 2026 at 7:41 am
    <?php
    
    $sql = 'SELECT uID FROM ldc_user_details where uID=3';
    
    // no need to use prepare() here unless there's a user input
    
    $q = $this->db->query($sql);
    
    // a check for rowCount would be good
    if ($q->rowCount() > 0) {
    
        // all results will be in $i
        $i = $q->fetchAll();
    
         foreach ($i as $key => $val){
    
             echo "Key : {$key} <br> Val : {$val}";
         }
    }
    else {
        die("Zero Results returned");
    }
    

    ?>

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

Sidebar

Related Questions

I trying execute next FQL query SELECT uid FROM user WHERE name='Vovka' and getting
I'm trying to select dynamic ids when a user types something into the input
I am trying to come up with a form that lets the user select
I am trying to display a Spinner list for user to select, then take
I'm trying to do stuff (fill another select) when the user selects something in
I'm trying to develop a Lync application that allows a user to select which
I'm trying to modifty the Flex Tree control to allow a user to select
What I'm trying to do is, I'm asking user to select a value from
I'm trying to access basic information from a FRIEND page via FQL: SELECT name,
I'm trying to do the following Facebook Query Language query: https://api.facebook.com/method/fql.query?query=SELECT name FROM user

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.