After months in which we are interested in the theory of programming language PHP, it’s time to put into practice our knowledge, we start with the design and creation of a management application with LAMP or WAMP. The project is to develop a website article after article for simplified management of the sale of inventory items, before we tackle the problem of the administrative side, with insertion, deletion and modification of materials and then the space reserved for the public with the sales department, management of the shopping cart and payment. From time to time be releasing the source of the development of this project, which can be fully customized according to your knowledge. The web application for inventory management and sales will not have anything professional, it is always and only educational materials, so if you are looking for a program for your online store, I suggest you read my article on the creation of a e-commerce site at low cost.
The first step to be made in developing management application is to create the database (MySQL) for data entry project, called “Cerberus” (you can decide to call it what you will, when all my imagination stops here). Within the database, insert the table of directors of the archive, ie those that can manage articles, in practice the back of the application; obviously these users must login access in order to act. We can create a table called “users” where users can go either storeadmins, both the buyers, we can identify them by a Boolean (bit).
Table users
UserID of type long counter and primary key
EMail varchar length 100 characters and that will be the userid
Password varchar length of 20 characters
Administrator of type bit
You can also add other fields that represent the users, but these are the basic ones, which are used to recognize our visitors. The management of login and start session we tackled the last lesson of our course on php and then we just take that code and adapt it to our new project. So let’s create the table that will house our inventory items, but before we insert one of the categories.
table categories
CategoryID of type long counter and with primary key
Category varchar of 30 characters
The table will be set to only some categories that will insert values directly with phpMyAdmin. We must also create the table for the units.
Table unimis
IDUM type with long counter and primary key
Description varchar to 3 characters
Now let’s create the table for items.
Table articles
IDArticle type with long counter and primary key
CodInt varchar of 10 characters
CodBar varchar of 13 characters
Description varchar of 100 characters
IDUM of type long
CategoryID of type long
Price decimal 12.4
Notes of type text
Photo varchar of 200 characters
It would be better if you creaste the database, but if you wish you had let the sql file to import into your phpMyAdmin.
Next time we will create the web form for the management of articles and then we will let administrators access only, you add manually.