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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:02:56+00:00 2026-05-23T11:02:56+00:00

I am currently using MySQL and MyISAM. I have a function of which returns

  • 0

I am currently using MySQL and MyISAM.

I have a function of which returns an array of user IDs of either friends or users in general in my application, and when displaying them a foreach seemed best.

Now my issue is that I only have the IDs, so I would need to nest a database call to get each user’s other info (i.e. name, avatar, other fields) based on the user ID in the loop.

I do not expect hundreds of thousands of users (mainly for hobby learning), although how should I do this one, such as the flexibility of placing code in a foreach for display, but not relying on ID arrays so I am out of luck to using a single query?

Any general structures or tips on what I can display the list appropriately with?

Is my amount of queries (1:1 per users in list) inappropriate? (although pages 0..n of users, 10 at a time make it seem not as bad I just realize.)

  • 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-23T11:02:56+00:00Added an answer on May 23, 2026 at 11:02 am

    You could use the IN() MySQL method, i.e.

    SELECT username,email,etc FROM user_table WHERE userid IN (1,15,36,105)
    

    That will return all rows where the userid matches those ID’s. It gets less efficient the more ID’s you add but the 10 or so you mention should be just fine.

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

Sidebar

Related Questions

Greetings, I have some mysql tables that are currently using an md5 hash as
I'm currently developing a website which stores bookmarks in a MySQL database using PHP
Currently, I am using an with ajax to update my mysql. Now, I have
I have a php classifieds website (mostly) and I am currently using MYSQL as
currently we using MySQL. We have table with spatial index (so no InnoDB) and
i am using mysql and and php , currently i have date and time
We are currently using Mysql version 5.0 in our application and are thinking of
I am currently using PHP/MySQL and the jQuery timeago plugin. Basically, I need to
I'm currently using PHP, JAVASCRIPT, MYSQL, XHTML, CSS to develop my site. Note that
Currently i'm using pretty much Unix + Mysql + Perl + Apache with some

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.