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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:09:36+00:00 2026-05-26T03:09:36+00:00

I have a php browser based application that is for a hospital management system.

  • 0

I have a php browser based application that is for a hospital management system. The situation is that there are 3 departments from which payments are made ie. reception, lab and pharmacy. The worker at each location above is different and so is their input. Each of these departments sends a receipt information to one single table called receipts and hence an ID is generated which is the next ID after the last ID of the table. The data is sent back to the same department based on this ID (that was generated based on the last ID from the table).

Now the problem occurs when two departments click the submit button at the same time. Both these people get the same ID since at that time the last ID is the same for both queries. This will cause problems for storing and sending back data to the department.

Now is there a solution for this? I was told triggers would solve it but I don’t want to go there and keep it simple. I thought of random ID generation but the hospital guys want continuous ID as it will appear on the receipt.
Also take into account that the system should not slow down (considerably).

EDIT: Whoops seems like there is a lot more info here hence Autoincrement is not working.
There are 3 columns to consider ie. id(Pkey), receiptno and debitno.
Now if the person pays at the same time then the id and receiptno will be increased by one together and debitno will be empty. But if he is going to pay later then his receiptno is going to be NULL while his ID and debitno will increase by one from the last ID entered.
Therefore it is not necessary that the receiptno (that is going to be sent back to the department person) will be filled and hence auto increment would not work then correct?
Thanks guys again for your solutions esp autoincrement.

  • 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-26T03:09:37+00:00Added an answer on May 26, 2026 at 3:09 am

    Use an AUTO_INCREMENT (MySQL) field for the ID column so the database takes care of unique ID generation. Other database systems have similar fields, e.g. the serial field type in PostgreSQL.

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

Sidebar

Related Questions

We have a php/mysql based application which has slightly different instances for a number
I'm trying to create a PHP based application that allows students from my school
Here's the situation: I have a web-based ticket application, multiple users. One problem that
We have PHP 5.2.6 deployed to c:\php and in that folder there is the
I have php generated pages that change every few minutes based on the underlying
We have a jquery/php/mysql system that allows a user to log in and review
I have an applicaton written in PHP that retrieves files from mongoDB Grid collection,
What code do you need to add in PHP to automatically have the browser
I have example of code below. <script type=text/javascript src=assets/scripts/somescript.php>. </script> So, will my browser
I have PHP configured so that magic quotes are on and register globals are

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.