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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:36:52+00:00 2026-05-16T11:36:52+00:00

Can you do that? I just tried but it doesnt seem to work. I

  • 0

Can you do that? I just tried but it doesnt seem to work.

I have dbc.php included at top of my page, and in dbc.php at the bottom i created this function:

function getUserInfo($id) {
$thaString = mysql_query("SELECT * FROM users WHERE id = '$id'");
$thaString2 = mysql_query("SELECT * FROM users_profile WHERE uID = '$id'");
$showUR = mysql_fetch_array($thaString);
$showURP = mysql_fetch_array($thaString2);
}

So it would be easier for me to call them instead of running the queries all the time when i need them in other pages..
But when i try to do:

getUserInfo($showInfo["bID"]);
echo $showUR["full_name"];

I dont get any result, is there a smarter way to do this, if so how?

  • 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-16T11:36:52+00:00Added an answer on May 16, 2026 at 11:36 am

    It’s an issue of scope: $showUR is set inside getUserInfo(), so it’s not available to the echo outside the function. There are lots of potential modifications you could make, but you may want to assign your values into an array and then return that array:

    function getUserInfo($id) {
        $user = array();
    
        $thaString = mysql_query("SELECT * FROM users WHERE id = '$id'");
        $thaString2 = mysql_query("SELECT * FROM users_profile WHERE uID = '$id'");
        $user['showUR'] = mysql_fetch_array($thaString);
        $user['showURP'] = mysql_fetch_array($thaString2);
    
        return $user;
    }
    
    $user = getUserInfo($showInfo["bID"]);
    echo $user['showUR']["full_name"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this Trigger in Postgresql that I can't just get to work (does
In a C++ application that can use just about any relational database, what would
I just noticed that you can do this in C#: Unit myUnit = 5;
I just noticed that you can not use standard math operators on an enum
I've just found IPython and I can report that I'm in deep love. And
I've done numerous searches and I realize that I can just download this file
I can't be sure if my code is sucking, or if it's just that
Still new to Objective C, and I'm having some trouble that I just can't
It seems that anyone can snoop on incoming/outgoing .NET web service SOAP messages just
I just realised that Office 2007 now shows multiple pages per default. I can

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.