Automatic Class Generator In PHP With PDO

Automatically create classes in PHP to connect to the database using PDO. The script creates a class to perform the main functions for manipulating data in the db with the functions of inserting, updating, searching and deleting.


These are the functions that the script generates for earch table of database.

getList() - get all rows of the table.
loadById($id) - load into object the data from database.
insert() - Insert data into database table
insertReturningID() - Insert data into database table and return the inserted id.
update($id) Update the data from database table.
delete($id) Update the data from database table.

PHP version 7.0 or higher;

MySQL 4.x or MySQL 5.x

To use the script, unzip the files into a folder called "generate" and place this folder in the folder where the database table classes will be generated.

After placing the files inside the folder "generate" edit the file Sql.php and alter the lines to match the configuration of your database. To do that edit these lines:

const HOSTNAME = "";
const USERNAME = "root";
const PASSWORD = "123";
const DBNAME = "db_gameplay";

No reviews found!

No comments found for this product. Be the first to comment!

0 30
.php, .css, Javascript .js