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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:16:50+00:00 2026-06-10T23:16:50+00:00

Ok say i have 1 table for Users it stores USER_NAME, USER_ID, AND USER_COLOR

  • 0

Ok say i have 1 table for Users it stores USER_NAME, USER_ID, AND USER_COLOR
and im making a new table for Logs that will store USER_NAME

when viewing a page and i need to recieve this data
i can do 2 querys one for logs and then search users where USER_NAME=USER_NAME

or i can store USER_NAME, USER_ID, AND USER_COLOR all in logs
then i can get all the data with just 1 query.

what would be faster or better?

sample query

$sql = "SELECT id, username, level, namecolor FROM users ORDER BY level DESC"; 
$query = mysql_query($sql) or die(mysql_error());
$count = mysql_num_rows($query);
while($row = mysql_fetch_object($query)) {
    $Member_id = htmlspecialchars($row->id);
  • 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-10T23:16:52+00:00Added an answer on June 10, 2026 at 11:16 pm

    As you are using MySql, your database is a relational one.

    This gives you (as you already know) many advantages, so, instead of replicating the user information (already stored in its own table) in other table (logs in this case), you’d better to do joins when needing more information about a user.

    Let the users information to be in its own table, so, when querying logs data you may do this:

    SELECT logs.log_id, logs.log_date, logs.user_name, users.user_color
    FROM logs
    LEFT JOIN users ON logs.user_name = users.user_name
    

    Another point: think what would happen when replicating user info, if you add a new field to the user table (email for instance).

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

Sidebar

Related Questions

Let's say I have a table that has user_id, date, score, and every user
Say I have a table called Users, which contains your typical information: Id, Name,
Let's say I have a table called Users which represents registered users of a
Say I have three tables, a table of users, a table of around 500
Lets say I have a MySQL table, Users, like this - ----------------------------------------- ID |
Say I have a 'user_log' table with the following field: id user_id status_text timestamp
I have a table with two fields that describe opening hours of each store
Let's say I have information in a table that is in the wrong database
Say we have two tables in an MS Access db: Service Users: | ID
Let's say I have two tables, users and notes. Let's say the schemas look

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.