Simple Inventory System Using PHP/MySQLi with Source Code


Project: Simple Inventory System Using PHP/MySQLi with Source Code


I developed this code for those beginner programmers who found difficulties in creating their inventory system using PHP/MySQLi. The has a secure login because I have used md5 encryption for login and registration. It also generates reports such as daily, weekly, monthly, and yearly. To try this system just download and run this system. The inventory table or the list of products on the inventory page will serve also as the form for the sales. The use will select a product then by clicking the row, the product quantity sold cell will change into a text area where can the user enter the quantity sold, and by clicking anywhere on the page the value of the quantity sold input will be automatically saved in the database without leaving or refreshing the page.


  • Login Page
    • The page where the system users submit their system credentials to access the data and functionalities of the simple inventory system.
  • Registration Panel
    • This panel can be navigated by clicking the register ribbon at the top-right of the Login panel. This page is the form for creating a new system user and this requires the admin password.
  • Inventory Page
    • The page where the users will be redirected by default after logging into the system. This page displays the list of products and their details and at the same time, each row has a live editing feature and serves as the sale transaction form of the system.
  • Sales Page
    • The page where the total sales within the 2 selected dates are being displayed.
  • Add Item Page
    • The page where can system users add new stock for each product.
  • Add Product Page
    • The page where the system users submit the new product details.
  • Edit Price Page
    • The page where the system users update the price of the product.

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 "liveedit".
  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/inventory]

Default Admin Access

Username: admin
Password: admin


I hope this Simple Inventory System Using PHP/MySQLi project for beginners 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 codes 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 byKyle (not verified)on Thu, 02/27/2014 - 18:31

I would like to thank you personally. This is a big help for me learning php
Submitted bylaurencejean (not verified)on Tue, 03/04/2014 - 19:51

username and password not found..
Submitted byAnonymous (not verified)on Wed, 03/12/2014 - 00:16

bakit po hindi ako maka log in? Opps some thing went wrong po ung lumalabas... I need ur help po...

hi eto na lang po yung problem ko sa tableedit.php
Notice: Undefined variable: a in C:\xampp\htdocs\inventory\tableedit.php on line 283

Notice: Undefined variable: b in C:\xampp\htdocs\inventory\tableedit.php on line 283

anu po gagawin ko para matangal yung msg na yan tnx u po

pde po bang pahinge ng copy ng documentation ninyo jan tnx u ... kung ok lng po isend ninyo na lng sa y.m ko po na [email protected] tnx u

Submitted by4chan (not verified)on Thu, 04/03/2014 - 19:58

For those with errors on line 283/284, you need to select a date range first. Working fine here, with the exception of a few typo's which had to be changed to reflect the names in the corresponding tables. Thank you
Submitted byrosemar (not verified)on Tue, 04/29/2014 - 11:03

bakit hindi po ako maka log-in???,,,,query failed po yung lumalabas tapos sa registration,,pag nag register cannot add another user yung lumalabas???,,,please pm me @ [email protected]
Submitted byAnonymous (not verified)on Wed, 04/30/2014 - 15:18

when i log in and set the usernama and password to admin. its a message that said something went i fixed it? pls help me.... pls
Submitted bydejo (not verified)on Thu, 05/22/2014 - 21:20

I can not add items thorough the additem button..? please help
Submitted byApata Babajide (not verified)on Sat, 05/31/2014 - 00:00

Am short of words what more can I say than "Thanks so much..."?
Submitted byjrc (not verified)on Fri, 06/20/2014 - 01:18

Error when trie to loging Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at login.php:3) in login.php on line 5 Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent in login.php on line 55 Warning: Cannot modify header information - headers already sent by (output started at login.php:3) in login.php on line 61
Submitted byartha (not verified)on Tue, 08/26/2014 - 07:37

- in original code : ---------
Submitted byvictor daniel (not verified)on Sat, 08/30/2014 - 20:32

sales error i found so what are the code for sales
Submitted byx (not verified)on Tue, 09/02/2014 - 15:19

sir bakit hindi ko po ma import yung database eto poh yung lumalabas Error SQL query: -- -------------------------------------------------------- -- -- Table structure for table `inventory` -- CREATE TABLE IF NOT EXISTS `inventory` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT , `item` VARCHAR( 100 ) NOT NULL , `qtyleft` INT( 11 ) NOT NULL , `qty_sold` INT( 11 ) NOT NULL , `price` INT( 11 ) NOT NULL , `sales` INT( 11 ) NOT NULL , PRIMARY KEY ( `id` ) ) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =6; MySQL said: Documentation #1017 - Can't find file: 'inventory' (errno: 2)??? help poh newb lang poh kc ako sa php
Submitted bychess (not verified)on Sat, 10/11/2014 - 19:06

ahhm... sir , how can i add a sold items ??? when i click the row it won't work.. plzz . help me .
Submitted bychess (not verified)on Sat, 10/11/2014 - 19:10

sir, how can i add a sold items.. it won't work if i click the row .. in your codes
Submitted byMasterFerdz (not verified)on Wed, 03/25/2015 - 02:20

In reply to by chess (not verified)

if you are able to click the row and able to create input, all you have to do is refresh the page. thats the only flaw of this inventory sys. :)
Submitted byraffy (not verified)on Wed, 11/26/2014 - 15:59

its not working . login error !
Submitted byMasterFerdz (not verified)on Wed, 03/25/2015 - 02:17

In reply to by raffy (not verified)

If you are having login error, you might want to check the index.php to login.php to db.php check if all the code is connected to your database. admin admin
Submitted byDr. Switch (not verified)on Mon, 04/20/2015 - 08:19

Hmmmm... Nice Keep up to help others... at same time you gats update your scripts...
Submitted bypenggot (not verified)on Mon, 05/04/2015 - 10:22

for sure, galing lang itong codes na ito sa ibang website, kya ignore lang ang gngwa instead of debugging the errors..
Submitted byTiberiu (not verified)on Wed, 05/27/2015 - 04:18

Hi Argie,

Just looked at the code and I liked it.
I head a bit of headwind working through all the errors but with 2 hours if coding, all is working properly (at least for me :) ).
The code is nice and easy to read/adjust, but if I may, I would like to make some suggestions:
- for the Notice error: 'undefined index id' that everyone is complaining there are two simple mechanisms to put in place to make sure it doesn't show in the browser:
1. In index.php put the following lines:
echo '<ul>';
echo '<li>'." Registration Success You can now login ".'</li>';
echo '</ul>';
Normally this would not show if the error reporting level is set to low, so ...

2. Instruct users to set a lower error logging level like E_STRICT or E_ERROR or to exclude notice with ~E_NOTICE.

I would not suggest method 2 especially when you are in development mode :).

- mysql statement is deprecated in MySQL 5 so my suggestion is to use mysqli statements instead. This worked for me.

All in all, good code and really good effort. Keep on coding.

Submitted bySantheesh (not verified)on Tue, 07/07/2015 - 16:30

I dnt knw how to run the project please help me
Submitted byzuber (not verified)on Tue, 06/14/2016 - 15:48

I have help for php
Submitted byUniGirl (not verified)on Sun, 04/30/2017 - 01:15

I've error everytime I log in.. The error is : Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\inventory\inventory\db.php:6 Stack trace: #0 C:\xampp\htdocs\inventory\inventory\login.php(6): require_once() #1 {main} thrown in C:\xampp\htdocs\inventory\inventory\db.php on line 6 Can anyone fix this error for me? God bless you..
Submitted byAnonymous (not verified)on Sat, 05/06/2017 - 23:25

why is the log in broken? its just saying oops something went wrong? help me please
Submitted bytanarat (not verified)on Sun, 06/11/2017 - 22:32

very good best !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
Submitted bypeter Sowet Aduma (not verified)on Tue, 07/25/2017 - 00:14

thanks so much i hope the project will help me greatly...
Submitted byduralumin (not verified)on Wed, 10/04/2017 - 15:31

do you have a boyfriend?

Notice: Undefined index: date in C:-\inventory\inventory\tableedit.php on line 173 i didn't get what is the problem here and one more thing is here in inventory column the date is automatically changes which means the date is updated when we open the system. rectify and clarify me sir......its good coding. thank you so much
Submitted byneed help (not verified)on Thu, 12/07/2017 - 09:47

anyone can please help for: Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\inventory\inventory\inventory\db.php:6 Stack trace: #0 C:\xampp\htdocs\inventory\inventory\inventory\login.php(6): require_once() #1 {main} thrown in C:\xampp\htdocs\inventory\inventory\inventory\db.php on line 6
Submitted byNotFennic (not verified)on Thu, 01/25/2018 - 19:02

Excuse me are you using xammp because i use xammp for my project
Submitted byZoha (not verified)on Thu, 06/28/2018 - 16:50

hey i have imported the database and replace every where mysql to mysqli after doing all these i am having this error username missing and password is missing

Submitted byAnonymous (not verified)on Wed, 01/26/2022 - 21:57

I just want to ask why is not working it always says this Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in C:\xampp\htdocs\inventory\inventory\db.php on line 6 Opps some thing went wrong if I log in

Add new comment