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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:14:16+00:00 2026-05-25T01:14:16+00:00

My problem in fairly simple. I have a login system constructed using php, mysql

  • 0

My problem in fairly simple. I have a login system constructed using php, mysql databases, and ajax. Everything was working until today when I found a very potential problem that could completely confuse the system. Every single user in the database has a id that is automatically generated by setting auto-increment for the id column to give them a unique id. now my problem is that for example, my chat system, is trying to display all the users in the room. Well, the id for my first user is 1, and the id for the second user is 104. So, php extracts all the users id’s from the database, which is stored in this format:
user1id,user2id,user3id and so on. But when php searches those id’s for id #1 to see if it exists, it finds a 1 in id 104. That’s where the problem starts. Sensing that the user is already in, php changes the record accordingly, and updates the user list to this: 04,1. It was 104,1 before. Now, the script tries to locate the username for id #04, which doesn’t exist. Therefore, a incorrect list of users in the room is given. Now, the most sensible solution to this I think is to add 0’s infront of the shorter id’s, so instead of 104,1,it’s 104,001. But How exactly do I do that with auto increment? Thanks in advance.

  • 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-25T01:14:17+00:00Added an answer on May 25, 2026 at 1:14 am

    Thanks everyone, but I found a solution. I would get the longest value in the array after explode, and use str_pad to add enough 0’s to the end of every value in the array.

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

Sidebar

Related Questions

I have a fairly simple sync problem. I have a table with about 10
I have a fairly simple view hierarchy in my iPad app. Window -> RootView
I have a PHP web application where I've made a little module system, that
I trying to figure out how to solve this (fairly) simple problem but I
I have a fairly simple menu: <ul id=menu> <!-- TemplateBeginEditable name=mainmenu --> <li><a href=index.htm
I have a fairly simple website where users can fill out a form describing
I have a fairly simple call I'm trying to make to a database. I
I am fairly new to WPF and I am having a problem with inheriting
As a fairly junior developer, I'm running into a problem that highlights my lack
Problem: I have an address field from an Access database which has been converted

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.