If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form here. Thanks so much!
Hezecom PHP Code Generator is a PHP, MySQL and PDO code generator which generate classes for each table in your database. Its aim is to speed up your application development process. All you need to do is just create your database and the Code Generator will generate the classes which consist of INSERT, UPDATE, SELECT and DELETE which are the major database operations, not only that, it will also generate stylish CSS3 forms for INSERT and UPADATE, and also generate stylish CSS3 grid table to view all records and CSS3 table to view a single record based on the table name selected.
The generated classes are commented for easy understanding base on their operations, which means editing the code to your taste is very simple, if necessary. If you have not started using OOP in php, this will be a good starting point for you and if you have whao! Then enjoy the power of speed using this app to generate sophisticated code for your projects. Save time and money developing your app with just few clicks is so amazing and fun.
This guide covers both MySQL and PDO option.
Create MySQL database with table. E.g.
Unzip the CodeGen folder to your web directory and run it.
Complete your database settings example is shown below
Select a table you want to generate code for and click on the Generate button that’s all. Whether you are using MySQL or PDO data support layer is the same process. Example is shown below:
When you click on the Generate Codes button you will receive this message. You can click on the Preview Code Output link to see your generated code in action.
NOTICE: The aid on the form field is a primary key from the database above. It must be same with the database else your code will not work well.
Your generated code will be found in the folder named CodeOutput copy either PDOclass or MySQLclass folder depending on the option you selected and paste to anywhere you want to use it. It’s that simple.
IMPORTANT! Please don’t use the two options i.e. PDOclass and MySQLclass together; you can only use one option at a time.
I Recommend PDO for you, because the generated codes support multiple databases.
Whether you use PDOclass or MySQLclass the folder contain the following files and folders:
The database settings is located in the lib/config.php you can adjust if need be.
The classes/ folder contains all your classes. You can adjust any class if you feel like. Note that the PDO output class is slightly different from MySQL output class. e.g.
PDO and MySQL class example
PDO insert example
PDO select one record example
MySQL insert example
MySQL select one record example
You can further customize the SQL queries to suit your project requirements.
NOTICE: The sanitize and post are self-functioned functions used located at lib/functions.php. The sanitize function handles SQL injection, I didn’t use for PDO class because I am using PDO prepared statements which already handle SQL injection.
The files to include wherever you want to use the code generated by Hezecom Code Generator you must include the following files:
For MySQL include the following as shown below:
For PDO include the following as shown below:
The classes/class_accounts.php is just example of how to include the class generated the name changes depending on the name you give to the class from the class field. But the other three above remain like that.
This is just a single file in a folder called css/
Add it between the <head> and </head> in your html code like this:
<link rel="stylesheet" type="text/css" href="css/bootstrap.css" media="screen" />
Although all this has already been done for you by Hezecom Code Generator, so don’t worry about including anything, all you have to do is copy either the PDOclass or MySQLclass folder to your project location. That’s all.
View All Records Example
Please check the demo for more examples.