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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:48:12+00:00 2026-06-16T03:48:12+00:00

I am working on a friend list function and I can’t figure out how

  • 0

I am working on a friend list function and I can’t figure out how to correctly receive the values.

My code looks like this:

$getuid = $mysqli->prepare("SELECT `uid` FROM `users` WHERE  name = ? OR name = ?");
$getuid->bind_param("ss", $user, $friend);
$getuid->execute();
$getuid->bind_result($uid);
$getuid->fetch();
$getuid->close();
$resetpass = $mysqli->prepare("INSERT INTO `friendlist` SET `friend1`=?, `friend2`=?, `accept`=0");
$resetpass->bind_param("ss", $uid[0], $uid[1]);

With the first query I get exactly two uid values back. I want to use them in the second query. It seems like bind_result is not working, neither as array nor when using two values in bind_result. How can I do this using mysqli. I can’t use get_result because I’m on PHP 5.2 .

Anyone able to help me?

  • 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-16T03:48:13+00:00Added an answer on June 16, 2026 at 3:48 am

    Okay I finally understood the concept of fetch.

    In order to receive all the values I have to retrieve them in a while-loop.

    Here is the solution:

    $getuid = $mysqli->prepare("SELECT `uid` FROM `users` WHERE  name = ? OR name = ?");
    $getuid->bind_param("ss", $user, $friend);
    $arra = array();
    $getuid->execute();
    $getuid->bind_result($uid);
    while ($getuid->fetch()) {
        $arra[] = $uid;
    }
    

    Now I can call the array values using $arra[0] and $arra[1]

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

Sidebar

Related Questions

So I can't figure out why my insertion operator isn't working for my list
My friend and I are working on a program. This program is going to
I'm working on this site www.annapogossova.com for a friend. Currently the menu navigation is
I am working on a web based contact list for a friend. I have
This is supposed to be a working project from my friend. He demonstrated the
I am working on a project where the facebook's friend list have to de
I am working in a project where I need to get the friend's list
I'm working on a friends list type function that will display a user's friends
One of my friend is working on issue related to updating expired digital certificates.
I'm working on a project with a friend and I want to return to

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.