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

  • Home
  • SEARCH
  • 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 141957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:51:36+00:00 2026-05-11T07:51:36+00:00

I am a new php and mysql programmer. I am handling quite large amount

  • 0

I am a new php and mysql programmer. I am handling quite large amount of data, and in future it will grow slowly, thus I am using hash table. I have couple of questions:

  1. Does mysql have hash table built in function? If yes, how to use that?

  2. After couple of days doing research about hash table. I briefly know what hash table is but I just could not understand how to start creating one. I saw a lot of hash table codes over the internet. Most of them, in the first step in to create a hashtable class. Does it mean, they store the hash table value in the temporary table instead of insert into mysql database?

For questions 3,4 & 5, example scenario: User can collect items in the website. I would like to use hash table to insert and retrieve the items that the user collected.

  1. [Important] What are the possible mysql database structure looks like?

    e.g, create items and users table

    in items table have: item_id, item_name, and item_hash_value

    in users table have: user_id, username, item_name, item_hash_value

    I am not sure if the users table is correct?

  2. [Important] What are the steps of creating hash table in php and mysql? (If there is any sample code would be great :))

  3. [Important] How to insert and retrieve data from hash table? I am talking about php and mysql, so I hope the answers can be like: ‘you can use mysql query i.e SELECT * from blabla…’

  • 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. 2026-05-11T07:51:36+00:00Added an answer on May 11, 2026 at 7:51 am

    (sorry about the italics, underscores can trigger them but I can’t find a good way to disable that in the middle of a paragraph. Ignore the italics, I didn’t mean to put them there)

    You don’t need to worry about using a hashtable with MySQL. If you intend to have a large number of items in memory while you operate on them a hashtable is a good data structure to use since it can find things much faster than a simple list.

    But at the database level, you don’t need to worry about the hashtable. Figuring out how to best hold and access records is MySQL’s job, so as long as you give it the correct information it will be happy.

    Database Structure

    items table would be: item_id, item_name Primary key is item_id  users table would be: user_id, username Primary key is user_id  user_items table would be: user_id, item_id Primary key is the combination of user_id and item_id Index on item_id 

    Each item gets one (and only one) entry in the items table. Each user gets one (and only one) entry in the users table. When a user selects an item, it goes in the user items table. Example:

    Users:  1 | Bob 2 | Alice 3 | Robert  Items  1 | Headphones 2 | Computer 3 | Beanie Baby 

    So if Bob has selected the headphones and Robert has selected the computer and beanie baby, the user_items table would look like this:

    User_items (user_id, item_id)  1 | 1    (This shows Bob (user 1) selected headphones (item 1)) 3 | 2    (This shows Robert (user 3) selected a computer (item 2)) 3 | 3    (This shows Robert (user 3) selected a beanie baby (item 3)) 

    Since the user_id and item_id on the users and items tables are primary keys, MySQL will let you access them very fast, just like a hashmap. On the user_items table having both the user_id and item_id in the primary key means you won’t have duplicates and you should be able to get fast access (an index on item_id wouldn’t hurt).

    Example Queries

    With this setup, it’s really easy to find out what you want to know. Here are some examples:

    Who has selected item 2?

    SELECT users.user_id, users.user_name FROM users, user_items WHERE users.user_id = user_items.user_id AND user_items.item_id = 2 

    How many things has Robert selected?

    SELECT COUNT(user_items.item_id) FROM user_items, users WHERE users.user_id = user_items.user_id AND users.user_name = 'Robert' 

    I want a list of each user and what they’ve selected, ordered by the user name

    SELECT user.user_name, item.item_name FROM users, items, user_items WHERE users.user_id = user_items.user_id AND items.item_id = user_items.item_id ORDER BY user_name, item_name 

    There are many guides to SQL on the internet, such as the W3C’s tutorial.

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

Sidebar

Ask A Question

Stats

  • Questions 92k
  • Answers 92k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Have ClassA derive from MarshalByRefObject since it's the object you… May 11, 2026 at 6:27 pm
  • Editorial Team
    Editorial Team added an answer Without a doubt check out the videos and tutorials on:… May 11, 2026 at 6:27 pm
  • Editorial Team
    Editorial Team added an answer Yeah what Eric said. filesRead.Contains is not going to do… May 11, 2026 at 6:27 pm

Related Questions

I have inherited a broad, ill-designed web portfolio at my job. Most pages are
I'd like to store an additional column in a table as a 'sort value',
Hello new to PHP and in a bit of a bind. I need to
I am confronted with a new kind of problem which I haven't encountered yet

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.