How to create a simple CRUD PHP web application
A friend of mine recently conducted some paper based marketing effort via the daily newspaper to collect potential customer’s information in exchange for some free samples giveaway. photo credit: tastygoldfish
The response was quite good as many people filled up their information and sent in their newspaper cutting via snail mail.
Now that she has more than 5 thousand entries to deal with, she’s asking if there’s a way for her to easily outsource the task of entering these data into a centralized database.
She has gathered a few volunteers within her organization to help with the data entry.
So the big question now is, how can she automate and simplify this effort?
Initially I recommended that she try out Google Sites which I wrote about on this post - How to simultaneously enter data using Google Sites.
After going through the post she said that it’s a good idea but she didn’t like the fact that her potential customers information will be stored within Google servers.
So it looks like she needs a simple CRUD web application to be created and hosted in within her own office environment.
If you’re wondering what CRUD means, it stands for Create, Read, Update and Delete – the four basic functions of persistent storage in computer programming.
Basically a CRUD web application allows a user to easily:
- Add a new record
- View the details of a record
- Update an existing record
- And delete a record
So with this simple CRUD web app, I believe it should solve my friend’s problem and allow her volunteers to log into the internal web application to begin filling up data simultaneously.
To get the web application up within the shortest time possible, I recommended a software which helps to generate codes based on a database structure.
Previously I wrote about one such software which is capable of doing just that. The desktop app is AppGini.
To quickly see an output generated via this software, check out their online demo.
Some of the features that you see on the online demo are only available on their paid version. However the free version allows you to create a CRUD PHP web application in it’s simplest form and I will be walking you though the creation process.
Firstly you’ll need to download PHP Generator for MySQL.
Once downloaded, install it on a LAMP environment (Apache web server, PHP, MySQL). If you don’t have one, check out XAMPP.
Once installed, start by creating a database structure.
Launch PHP Generator for MySQL and once it loads, begin selecting the database connection details.
Notice how I selected the database name: potential_customers_DB.
Click Next to proceed to select the defined table: customers_details_table.
Since there’s only one table defined in the database, I can only mark one table.
Once the table is selected, I can now set the page properties by configuring which columns should be listed out as well as setting the column’s data properties which includes:
- Text Area
- Combo Box
- Radio Group
- and more
Next step is to select your preferred color scheme. At the moment there are 7 color schemes to choose from and preview. You even have the ability to customize the css to your preference.
Now for the final step! To select an output directory as well as add any header or footer details. Note that you can also add security options to allow only people with a username and password to login to the web application.
Click on the Ready button to instruct the software to generate the codes for the web app.
Now for the moment of truth and time to check out the application. I launched a browser and enter the following url: http://localhost/potentialcustomers/customers_details_table.php
Walla! I now see a table with no records at the moment. Let me try to add a new record.
After filling in some dummy details, clicking on the Insert button inserts the data into the database.
Notice under the actions menu, you can view additional details, edit the record, delete and copy.
The default search feature is also built in, allowing you greater and faster access to search for records easily.
Now that the web app is up and running, all you need to do is send the url to the respective users for them to begin entering data.
Once all the data has been entered, you can begin to analyze and use the data however you want.
Hopefully today’s walkthrough provides you with an insight as to how you can easily create a CRUD PHP web application without the need to write any codes.