Pharmacy Sales and Inventory System using PHP/MySQL with Source Code


Project: Pharmacy Sales and Inventory System using PHP/MySQL


The Pharmacy Sales and Inventory System is a simple project that will help pharmacy businesses manage the medicine that they are selling and monitor their available stocks. This will also help to track the expired medicine product on hand which this system notifies them when the expiry date of their stock will come. And by this, they will check the remaining stock of the medicine product that is expired and encode to the system to deduct the count of stock that has already for inventory monitoring and sales product availability. This system categorizes the medicine list by the type of medicine for and also the type of medicine such as tablet and capsule, with this feature will help the cashier to search in details of the product that the customer is looking for, for example, the customer is looking for a 500 mg of Amoxicillin capsule medicine which is categorized in the group of medicine use for an antibiotic but the pharmacy does not have stock of this medicine at that time, the pharmacist will simply search a product in detail and enter the antibiotics word in the search bar so the medicine with available stocks in antibiotics will be filtered then the pharmacist can offer another product that has a similarity with what the customer is looking for.

The flow of the Pharmacy Sales and Inventory System is as follows:

  1. The system admin will populate all the types of medicine and the same to the medicine category as well. This data is required when creating a new product in the medicine list to categorized the medicine product.
  2. The system admin will populate also the list of medicine that the pharmacy's selling.
  3. The system admin will also list the suppliers of the pharmacy. This will help the pharmacy to track the supplier of the stock in receiving.
  4. The receiving feature will be the stock in process of the system which is this process must be done first before they will create a transaction in sales. This list must be populated by the system admin for the availability of the medicinal product in the system.
  5. The system admin will populate the list of customers in order to be used in sales transaction to track the client or customer that have bought medicine in the pharmacy. This feature is optional whereas the pharmacist can create a sales transaction where the customer will be known as a guest in the system
  6. After the system admin done in populating the list mentioned above, the system admin or pharmacist can start using the sales feature of the system.


  • Login Page
    • The page of the system where system users will submit their system credentials to access the data of the pharmacy sales and inventory system.
  • Home Page
    • The page where the system users will be redirected by default after logging into the system.
  • Medicine List Page
    • The page where all the medicine available at the pharmacy is listed and can be managed only by the system admin user.
  • Medicine Category Page
    • The page where all medicine categories are listed and can be managed.
  • Medicine Type Page
    • The page where all the medicine product types are listed.
  • Supplier List Page
    • The page where can the admin manage the list of the pharmacy's suppliers.
  • Receiving Page
    • The page where will the admin encode the received medicinal product that has been bought to the supplier by the pharmacy. This the feature that updates the product stock availability in the pharmacy.
  • Customer Page
    • The page where all of the pharmacy's customers are listed.
  • Sales Page
    • The page where the sale transaction is being made. The Sales list is listed on this page.
  • Inventory Page
    • The page where can the pharmacy management monitor the stock of their pharmacy.
  • Expired List
    • ​​​​​​​The page where the confirmed stock thas has expired will be listed in order to deduct the available stock of a certain product in the system.
  • User List
    • ​​​​​​​The page where can system admin manage the list of the pharmacy sales and inventory system users list.

How to Run

  1. Download the source code and extract the zip file.
  2. Download or set up any local web server that runs PHP script.
  3. Open the web-server database and create a new database name it pharmacy_db.
  4. Import the SQL file located in the database folder of the source code.
  5. Copy and paste the source code to the location where your local web server accessing your local projects. Example for XAMPP('C:\xampp\htdocs')
  6. Open a web browser and browse the project. E.g [http://localhost/pharmacy-sales-and-inventory-system-using-php]

Admin Default Access

Username: admin

Password: admin123

I hope the simple Pharmacy Sales and Inventory System using PHP/MySQL project will help you with what you are looking for. Feel free to download and modify the source code.

Explore more on this website for more Source Code and Tutorials.


Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Submitted byFredfranc (not verified)on Thu, 10/08/2020 - 18:21

The sql database is not available at the database folder

Fatal error: Uncaught Error: Call to a member function fetch_array() on bool in C:\xampp\htdocs\pharmacy-sales-and-inventory-system-using-php\pharmacy\login.php:18 Stack trace: #0 {main} thrown in C:\xampp\htdocs\pharmacy-sales-and-inventory-system-using-php\pharmacy\login.php on line 18

Submitted bykos (not verified)on Fri, 10/09/2020 - 19:32

thanks for all the work but the database file you attached is a wrong excel file
Submitted byjonmachi (not verified)on Fri, 10/09/2020 - 20:26

The database is not in database folder
Submitted byoretnom23on Sun, 10/11/2020 - 13:48

Hi guys. Sorry for the mistake. I have updated the source code. The SQL file is now included in the database folder. Thanks

Submitted byWhat is the us… (not verified)on Thu, 02/18/2021 - 18:10

Why the username and password is not working :(
Submitted byAnonymous (not verified)on Fri, 03/12/2021 - 18:21

Not Found The requested URL was not found on this server. Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/7.3.27 Server at localhost Port 80
Submitted byezatullah_admin (not verified)on Thu, 05/06/2021 - 17:19

Username or password is incorrect.
Submitted byALI HUSNAIN (not verified)on Sat, 06/19/2021 - 19:11

username or password incorrect. plz review and correct.
Submitted byMightUseIt (not verified)on Fri, 08/27/2021 - 08:29

I check your project, tried it. Everything works perfectly. Please reach out in case you wish to take it to another level. here is my email [email protected]
Submitted bytrizah (not verified)on Tue, 11/16/2021 - 18:52

In reply to by MightUseIt (not verified)

hello, kindly share with me the login credentials i.e username and password

Hi, I did check the system using the latest xampp and I did find the error in logging in. Sorry for the inconvenience. It was because of the strict mode of the latest PHP version. To fix it, kindly open the admin_class.php in your text editor and go-to line 39, and replace the code with the code below.


Submitted byMD RAFI (not verified)on Wed, 11/17/2021 - 16:02

I check your project, tried it. Everything works perfectly. Please reach out in case you wish to take it to another level. here is my email ...... [email protected]
Submitted byMansoori Aaraf… (not verified)on Thu, 09/01/2022 - 00:31

Good project.
Submitted bymaish (not verified)on Fri, 01/06/2023 - 19:31

i tried to add a new product but it would not allow saving
Submitted byalifya (not verified)on Tue, 03/28/2023 - 15:26

hello, why when I clicked pay the inventory is not automatically updated?
Submitted by Vin (not verified)on Fri, 03/31/2023 - 13:31

Hi, newbie here. just want to ask, in sales page. instead of reference number is it possible to replace it with cashier details?

Hi, newbie here.

Just want to ask, in the sales page

instead of reference number, is it possible to replace it with user details who did the transaction.

thankyou in advance.

Submitted byAnonymous (not verified)on Wed, 06/07/2023 - 09:50

Inventory side is not working when a new drug is sell
Submitted byAnonymous (not verified)on Thu, 12/07/2023 - 08:29

hello I have question regarding in the option in casher and admin, I want to add a another option of a employee to access the receiving, where I can edit the code, which part.

Add new comment