Skip to main content

Simple Inventory System Using PHP/MySQLi with Source Code

Language

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

About

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.

Features

  • 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

Demo

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.

Enjoy!

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 SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

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.

Comments

Submitted byAnonymous (not verified)on Mon, 08/20/2012 - 02:29

Hi. Am I using the correct username and password? I use "admin" for both but I get an error message that username and password not found. I tried entering "3", "admin", "admin" on the register form based on the value on the database but it says "You dont have access to add user pls. contact the administrator".

Submitted byAnonymous (not verified)on Thu, 08/23/2012 - 15:21

error in log in

Submitted bymarc david galang (not verified)on Sun, 07/20/2014 - 22:08

In reply to by Anonymous (not verified)

baka may mali sa database mo or yung login_process mo.

Submitted byrenee (not verified)on Fri, 11/02/2012 - 14:29

Hi Argie,

Great code but I do have a question though. On the add item, instead of adding the stock, the app just updates the value of qtyleft. For example the product "qweqwqw" has 10 on qtyleft and if I go to add item and put 15 on quantity, I would like qweqwqw to become 25 instead of 15. How do I go about this? Thanks.

Hoping for your reply.
-Renee

Submitted byrenee (not verified)on Sat, 11/03/2012 - 01:24

In reply to by argie

Hi Argie,

I have sent you a PM. I hope you can help me.

Regards,
Renee

Submitted byAngelie (not verified)on Sat, 08/09/2014 - 17:36

In reply to by argie

Hi Argie .. I am Angelie can I ask for your help ?? I downloaded your codes , but the sales one .. is not working :( I hope u can help me .. thank u :D

Submitted byzethan villarino (not verified)on Fri, 05/08/2015 - 14:22

In reply to by argie

you look grreat huh teach me how to make a basic program in easyway???

Submitted byAnonymous (not verified)on Fri, 12/21/2012 - 14:53

bakit po yung sa add product nag iinstant update po? d po nag aadd..? tnx..

Submitted byAnonymous (not verified)on Thu, 11/07/2013 - 15:26

In reply to by Anonymous (not verified)

sira yung codes mo

Submitted byAnonymous (not verified)on Sat, 01/05/2013 - 07:13

thanks argie!

to all those who are complaining - password, some features not working, blahblah.. why don't you all try to put an effort in reading the code and do a little bug fixing. yes, there are some minor bugs but otherwise argie's work is fine. sheesh!

for one thing, the login, of course, will not work if you haven't damn loaded the SQL file.

Submitted byzxzx (not verified)on Mon, 06/01/2015 - 02:38

In reply to by Anonymous (not verified)

where is db file

Submitted byAnonymous (not verified)on Sat, 01/05/2013 - 14:52

change updateproduct.php file to:

$proid=$_POST['ITEM'];
$itemnumber=$_POST['itemnumber'];
//mysql_query("UPDATE inventory SET qtyleft='$itemnumber'
//WHERE id='$proid'");

$result = mysql_query("SELECT * FROM inventory
WHERE id='$proid'") or die(mysql_error());

$row = mysql_fetch_array( $result );

$count = $row['qtyleft'] + $itemnumber;

$result = mysql_query("UPDATE inventory SET qtyleft='$count' WHERE id='$proid'")
or die(mysql_error());

header("location: tableedit.php#page=addproitem");
??>

Submitted byAnonymous (not verified)on Tue, 01/08/2013 - 09:54

it's all working fine. nice!

Submitted byjikan (not verified)on Mon, 10/14/2013 - 23:21

In reply to by Anonymous (not verified)

what did you do to work?

Submitted byAnonymous (not verified)on Fri, 01/11/2013 - 10:52

hello why is it that there is always error to the qty sold in the inventory??? "Notice: Undefined variable: rtrt in C:\wamp\www\inventory\tableedit.php on line 207" that is exactly the error and i did not change everything :) thank you

Submitted byAnonymous (not verified)on Tue, 01/22/2013 - 12:57

In reply to by Anonymous (not verified)

i tried removing that error and still run. . just remove the following error listed there

Submitted byAnonymous (not verified)on Sun, 01/13/2013 - 07:43

If you need help putting the inventory system to work, you can contact me and for a small fee $20) I can help you get it up and running: [email protected]

Submitted byAnonymous (not verified)on Tue, 01/22/2013 - 12:55

hi argie when i put integer in the quantity sold field in the inventory i need to refresh the system to see the computation in the sales field. . what i am looking is that when i put integer it must be automatically compute and no need to refresh sir argie! but still your program is great very helpful gb

Submitted byAnonymous (not verified)on Sun, 02/10/2013 - 23:38

Hi Argie,

Need help on the sales menu. Error are listed below:
Notice: Undefined index: from in C:\xampp\htdocs\inventory\tableedit.php on line 283

Notice: Undefined index: to in C:\xampp\htdocs\inventory\tableedit.php on line 284

The codes are: $a=$_POST['from']; $b=$_POST['to'];

Any thoughts about this?

Thanks a lot!

Jean

Submitted byAnonymous (not verified)on Wed, 02/20/2013 - 23:48

thx will see it n back to u soon

Submitted byAnonymous (not verified)on Thu, 02/21/2013 - 18:43

tq argie for share some script :)
but, I found bug, can u update this script, I just can't how to fix this :(

Submitted byAnonymous (not verified)on Sat, 02/23/2013 - 13:59

ayaw maglog in

Submitted byAnonymous (not verified)on Sun, 03/24/2013 - 20:50

hello po... bakit po ba nka error ang log in...

Submitted byAnonymous (not verified)on Mon, 04/01/2013 - 14:43

In reply to by Anonymous (not verified)

try mo iload ang sql file sa db... pra mgkaruon nang content ang db mo

Submitted byAnonymous (not verified)on Sun, 04/28/2013 - 21:09

I am new in php.I downlode it and when i run this project above
error display & also Notice:undefined indexd : id in c:\wamp\www\inventory\index.php on line 49
please reply

Submitted byAnonymous (not verified)on Thu, 05/23/2013 - 16:39

Dear Argie,
Am doing the same project for my final year. Could i kindly have your documentation spefically the literature review so i could cite you as my source. Please.

Submitted byAnonymous (not verified)on Fri, 05/31/2013 - 07:42

something wrong with your database when i import it on mysql

Submitted byMasterFerdz (not verified)on Wed, 03/25/2015 - 02:15

In reply to by Anonymous (not verified)

If you will check and read the sql there is nothing wrong with it. if import is not working for you, just manually encode the sql code and the run it.

Submitted byanonymouson Fri, 06/07/2013 - 07:38

This is very close to what I was looking for - close enough that I can pull snippets from here and there. It took all of 5 minutes to realize that I needed to add the following to the liveedit.sql:

CREATE DATABASE `liveedit`;
USE `liveedit`;

and change the user and password in db.php.

Submitted byAnonymous (not verified)on Sun, 07/14/2013 - 22:20

hey, thanks for the code, it is precise and concise to what i needed, am still a novice at php.mysql, but it seems there are some errors, these i get when i try running it, when i go to the sales tabs i get this

Notice: Undefined index: from in /Applications/MAMP/htdocs/inventory/inventory/tableedit.php on line 288

Notice: Undefined index: to in /Applications/MAMP/htdocs/inventory/inventory/tableedit.php on line 289

when i try prinitng the it seems to havent defined the variable $rtrt in table edit.php, help me to fix this
ma email adress is [email protected]

Submitted byEun (not verified)on Sun, 08/04/2013 - 00:24

Good Day, I have downloaded this file but it seems every time I log in it says Opps some thing went wrong.

It also has a notice:

Notice: Undefined index: id in C:\xampp\htdocs\inventory\index.php on line 49

What does it mean? How do I get the program running? Please help, I want to learn more about making an inventory system using php/mysql :3

I'm a junior IT student and I'm also working on my own inventory system. I need to research more design and layouts. Thanks! :)

Error: Opps some thing went wrong

login.php

--Original Code--
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "liveedit";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password)
or die("Opps some thing went wrong");
mysql_select_db($mysql_database, $bd) or die("Opps some thing went wrong");

--My changes--

$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "inventory"; //chaange this name of datbase name
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password)
or die("Opps some thing went wrong");
mysql_select_db($mysql_database, $bd) or die("Opps some thing went wrong");

I hope it will help to you guys.

Thanks,

Submitted byhelloworld (not verified)on Wed, 08/07/2013 - 21:57

why is not computing the sales ? help me

Submitted bychim (not verified)on Wed, 08/07/2013 - 23:33

hello

Submitted byk Sharma (not verified)on Thu, 08/29/2013 - 16:40

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\inventory\login.php:3) in C:\xampp\htdocs\inventory\login.php on line 5

how can i solved the problem

thank u

Submitted byChammburger (not verified)on Fri, 11/27/2015 - 10:17

In reply to by k Sharma (not verified)

Remove the empty lines and spaces at the beginning of login.php. The opening block of the php function should be the first think in the page. I had two blank lines when I installed. The error went away after deleting the two empty lines.

Submitted byFams (not verified)on Tue, 10/01/2013 - 20:29

Notice: Undefined index: id in C:\wamp\www\inventory\index.php on line 49

Submitted bytuytooshon Sun, 11/10/2013 - 06:12

i cant work with it

i import sql file with phpmyadmin and run script but when i loged in the browser said "Query failed"

Submitted byShawn H. (not verified)on Sat, 12/07/2013 - 06:25

I am very new to this...Where do you put the folder with all the files???

I am using phpmyadmin

Submitted byrandi (not verified)on Mon, 01/06/2014 - 10:08

sorry i'am not accesss your progrem

Submitted byMalay Majumdar (not verified)on Mon, 02/10/2014 - 15:43

Unable to access db. After login shows the page "Opps some thing went wrong" please advise.

Submitted byterance (not verified)on Wed, 02/19/2014 - 19:51

it works correctly.first of all you have to import mysql database into the server.then type username and password.

Add new comment