PHP Simple Inventory
Simple inventory management system built with native PHP and MySQL for small businesses
Share this project:
Project Overview
PHP Simple Inventory System
A straightforward inventory management system built with native PHP and MySQL. This project was created during my high school years to help small businesses manage their product inventory efficiently.
📋 Overview
This simple inventory system provides essential functionality for tracking products, stock levels, and basic transactions. Built without frameworks, it demonstrates fundamental PHP and MySQL concepts in a practical business application.
✨ Features
-
Product Management
- Add new products
- View all products
- Update product information
- Delete products
- Track stock quantities
-
Stock Operations
- Add stock (incoming goods)
- Reduce stock (outgoing goods/sales)
- View current stock levels
- Low stock alerts
-
Basic Reporting
- Product list
- Stock movements
- Current inventory status
-
Simple Interface
- Easy-to-use dashboard
- Clean data tables
- Quick add/edit forms
🛠️ Technologies Used
- PHP: Native PHP (no frameworks)
- MySQL: Database
- HTML/CSS: Frontend
- JavaScript: Client interactions
- Bootstrap (if used): UI framework
📁 Project Structure
php_simple_inventory/
├── index.php # Main dashboard
├── proses/
│ ├── tambah.php # Add product
│ ├── edit.php # Edit product
│ ├── hapus.php # Delete product
│ ├── stok_masuk.php # Add stock
│ └── stok_keluar.php # Reduce stock
├── assets/
│ └── css/
│ └── style.css # Custom styles
├── inventory.sql # Database schema
└── README.md
🚀 Getting Started
Prerequisites
- XAMPP, WAMP, or similar local server
- PHP 5.6 or higher
- MySQL 5.5 or higher
Installation
-
Clone or Download
git clone <repository-url> -
Move to Server Directory
# XAMPP mv php_simple_inventory C:/xampp/htdocs/ # WAMP mv php_simple_inventory C:/wamp64/www/ -
Create Database
- Open phpMyAdmin:
http://localhost/phpmyadmin - Create database named
inventory
- Open phpMyAdmin:
-
Import Schema
- Select
inventorydatabase - Import
inventory.sqlfile - Tables will be created automatically
- Select
-
Start Server
- Start Apache and MySQL in XAMPP/WAMP
-
Access Application
http://localhost/php_simple_inventory
💻 Usage
Dashboard
- View summary of total products
- See low stock warnings
- Quick access to all features
Adding Products
- Click "Add Product"
- Enter product details:
- Product name
- Product code/SKU
- Category
- Initial stock
- Unit price
- Save product
Managing Stock
Add Stock (Stock In):
- Select product
- Enter quantity to add
- Add notes (supplier, purchase order, etc.)
- Submit
Reduce Stock (Stock Out):
- Select product
- Enter quantity to reduce
- Add notes (sales, damage, etc.)
- Submit
Viewing Inventory
- Main page shows all products
- Displays current stock levels
- Color-coded low stock indicators
🗄️ Database Schema
Table: products
CREATE TABLE products (
id INT AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50) UNIQUE,
name VARCHAR(100),
category VARCHAR(50),
stock INT DEFAULT 0,
min_stock INT DEFAULT 10,
price DECIMAL(10,2),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Table: stock_transactions
CREATE TABLE stock_transactions (
id INT AUTO_INCREMENT PRIMARY KEY,
product_id INT,
type ENUM('in', 'out'),
quantity INT,
notes TEXT,
transaction_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (product_id) REFERENCES products(id)
);
🎯 Use Cases
- Small retail shops
- Warehouses
- School/office supply management
- Workshop inventory
- Home-based businesses
🔧 Configuration
Database connection in config.php or similar:
<?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "inventory";
$conn = mysqli_connect($host, $user, $pass, $db);
?>
🐛 Troubleshooting
Can't Connect to Database
- Ensure MySQL is running
- Check database credentials
- Verify database name is correct
Products Not Showing
- Check if data exists in database
- Verify SQL query syntax
- Check for PHP errors
🚀 Future Enhancements
- User authentication
- Supplier management
- Purchase orders
- Sales tracking
- Advanced reporting
- Barcode scanning
- Export to Excel/PDF
- Multi-warehouse support
🎓 Learning Value
Built during high school, this project taught:
- PHP fundamentals
- MySQL operations
- CRUD implementation
- Inventory management concepts
- Web application structure
🤝 Contributing
This is a learning project. Feel free to fork and improve!
📄 License
Open source - educational use.
Built in High School 📦✨
A simple solution for small business inventory needs