What is the best PHP crud class? #crud
 Edit
 by ahmed aabuzaid - 9 years ago (2016-03-26)
 by ahmed aabuzaid - 9 years ago (2016-03-26)
How to create CRUD with PHP
|  | I would like to know how to create CRUD interface with PHP. I want sample code. | 
- 3 Clarification requests
- 3.  by Fransim - 3 years ago (2022-01-25) Reply by Fransim - 3 years ago (2022-01-25) Reply
 
- 2.  by Hariharan Natarajan - 7 years ago (2017-10-31) Reply by Hariharan Natarajan - 7 years ago (2017-10-31) Reply
 
- 1.  by Anichandran Ayysamy Ayyanallur - 7 years ago (2017-08-23) Reply by Anichandran Ayysamy Ayyanallur - 7 years ago (2017-08-23) Reply
 
Ask clarification
6 Recommendations
B12 PHP FW: Manage database records with a PDO CRUD interface
This class can manage database records with a CRUD interface.
It provides classes that can connect to a database using PDO and perform queries to create, retrieve, update and delete records of a given table.
The package can display the Web interface to let users perform these operations with the possibility to customize the actions that access interface with application customization code.
|  |  by Slavko Srakocic  package author  65 - 3 years ago (2021-09-15) Comment
 See https: github.com slavkoss fwphp for newest code.
On B12phpfw global-shared core code skeleton package (abstract class Config_allsites and trait Db_allsites) are 3 main packages (Oracle Forms modules subgroups in modules group folder glomodul, each module in own folder, no M, V, C folders for all modules-CRUD pages) :
  1. Mnu (menus), 
  2. Mkd (WYSIWYG markdown editor eg Simplemde, or may be HTML editor eg Summernote), 
  3. Msg (blog based on best blogs I could find in learning sources on Internet). There are also few packages which show what ideas others have about MVC, namespaces, PDO CRUD... In my opinion it is bad (beginner), too complicated idea that each table has own CRUD class. Oracle Forms rejected such idea few dozen years ago, but PhpClasses best ranked MVC package makes science of scafolding - automatically generating each table own CRUD class, simmilar like Yii and other "best" PHP fw-s. What wonders me, they do not even mention other possibilities - bad praxis in many things, in many activities (because not explaine life is not worth living). In my opinion it is bad (beginner), too complicated idea M, V, C folders for all modules-CRUD pages.
Yes Oracle Forms has libraries but not used for this purpose (I in 23 years working in Oracle Forms did not used Oracle Forms libraries). Ideas like PRE-CRUD code (in web programming called adapters) are explained complicated, mistificated, not simply explained like in B12phpfw. Where best PHP frameworks have dozens megabytes of complicated code, B12phpfw has few kB of simple code. It seems to me B12phpfw (my "Oracle Forms modules" way in PHP programming) is unique and best idea, and, at least, best for learning PHP. | 
Simple CRUD with MySQL 2: Output SQL and CRUD forms based on remoteDB class
This class can generate SQL and CRUD forms based on remoteDB class.
It is a class derived from the original work by Mahboobz. This version was improved in the following ways:
Version 4:
Update: replaced irp_commonSQL.php (obsolete) with common_pdo.php
Version 3:
- Added 2 more callback: before_save(), before_updated()
- Tested on Master-detail tables: see example pages
- Tested on view tables.
Version 3: added 2 new hooks, and master->detail capability
           added 2 functions: setEdit() and setDelete() to control buttons
Version 2:
- Added $this->index array to store one or more PK names (in place of one pre-defined PK='id')
- Added get_where(), get_hidden($record) to handle multiple PKs
- Added optional hook and callback to customize the CRUD page:
  1) special input fields: select, radio... (crud_get_input)
  2) special edit  fields: select, radio... (crud_get_edit)
  3) special show  fields: links, references... (crud_get_show)
  4) more actions in table (crud_action_hook)
- Added 3 static utility: make_select, make_radio and make_checkbox for input/edit fields
- Added CONFIRM to delete
- Added $extrasql parameter to renderVertically(), to extend the basic sql: "SELECT * FROM ".$this->table 
- Cosmetic minor variations, use of css file (in: remoteDB/css/style.css)
|  |  by Marco Sillano  package author  255 - 7 years ago (2018-04-22) Comment
 A simple CRUD class.
Requires very little code, but you can do stong customization usinng optional callbacks (lookups tables, format fields, radio button entry etc.)
Allows master-detail pages, e.g. for invoices management | 
- 2 Comments
- 1.  by Domenico Casaccia - 4 years ago (2021-02-20) Reply by Domenico Casaccia - 4 years ago (2021-02-20) Reply
 - jkjjkljkl 
- 2.  by Marco Sillano by Marco Sillano package author - 4 years ago (2021-06-16) in reply to comment 1 by Domenico Casaccia Reply package author - 4 years ago (2021-06-16) in reply to comment 1 by Domenico Casaccia Reply
 - Qualche problema? Che cosa non hai capito? 
MySQL Class Generator: Generate classes to access MySQL as objects
This package can automatically generate PHP classes from  MySQL tables.
It can access a given MySQL database and retrieve schema tables and fields.
For each table, it generates a class that uses object-oriented programming logic to provide methods for accessing, reading, and writing its records.
|  |  by Saro Carvello  package author  515 - 8 years ago (2017-02-08) Comment
 <h1>MySQLReflection</h1>
<h2>A useful utility for the Object Relation Mapping of MySQL databases</h2>
<p>This package can generate classes to access MySQL as objects.<br>
<br>
It can access a given MySQL database, retrieve its schema of tables and fields, and generates classes to access the records of tables as objects.<br>
<br>
The generate classes have setter and getter functions for accessing record field values, as well functions to insert, update and delete table records.</p> <p>An auto generated MySQL class provides the following services:</p>
<ul><li>A constructor for managing a fetched table?s row or for a adding a new one</li>
<li>Management for both single or composite Primary Keys</li>
<li>Automatic mapping of the different date formats may occurs between application and database</li>
<li>Destructor to automatically close database connection</li>
<li>Defines a set of attributes corresponding to the table fields</li>
<li>Setter and Getter methods for each attribute</li>
<li>OO methods for simplify DML select, insert, update and delete operations</li>
<li>A facility for quickly updating a previously fetched row</li>
<li>Useful methods to obtain table DDL and the last executed SQL statement</li>
<li>Error handling of SQL statements</li>
<li>Camel/Pascal case naming convention for Attributes/Class used for mapping Fields/Table</li>
<li>Useful PHPDOC information about table, fields and the usage of class, attributes and methods</li>
</ul>
<p>Developers can quickly use these generated classes on their application.</p> | 
Crudx: Store and retrieve objects in MySQL using MySQLi
This class can store and retrieve objects in MySQL using MySQLi.
It can create objects associated to a given table that will retrieve its record fields to a given database. It also supports conditions and joins with other tables.
The class can also insert, update and delete records from the current object variables.
Variables may be retrieved or set using getters and setters.
|  |  by Nahid Bin Azhar  package author  40 - 8 years ago (2017-01-17) Comment
 You can use Crudx php class. These following features are include with this class 
Laravel Eloquent style data save and update
Insert with array data.
Generate all types of query as method chaining.
Joining
Deleting
Sorting
Group
Raw query enable
Fetch all types of data as objects
 | 
Database ORM Builder: Generate MySQL Object Relational Mapping classes
This package can generate MySQL Object Relational Mapping classes.
It can retrieve the list of tables and fields of a MySQL database and generates classes with functions for storing and retrieving objects in the given MySQL database tables.
The generated code is stored in a file with the name based on the database name. For each table it generates a class for accessing fields, table data and execute SQL SELECT, INSERT, UPDATE and DELETE queries.
|  |  by Anthony Amolochitis  package author  505 - 9 years ago (2016-04-16) Comment
 I built this CRUD class.  It reads your database and builds a library of classes that represent your database tables.  A field class, data object class, and TableQuery class for each table will be built into a php file.  It is designed this way to avoid using loops to generate queries for improved speed.  I believe you will like what this class does once you use it.  There is sample code on the class page.   | 
Short Code CRUD: Perform CRUD operations on MySQL table records
This class can perform CRUD operations on MySQL table records.
It can perform several types of operations with records of a given MySQL table like:
- InsertRecord : Insert Record to database
- InsertMultipleRecord : Insert Multiple Records
- GetSingleRecord : Retrieve Single Record for Edit or View Action
- GetRecord: Get All or a limited number of Records with pagination
- UpdateRecord : Edit or Update Record Method
- DeleteRecord : Delete Record Method
- GetCustom : For results for arbitrary queries
The class can also generate HTML to display or update the table records like:
- PagiNation : Pagination Display 
- UploadFile : Upload File
- DeleteFile : Delete File
- DateDifference : Date Difference
- RedirectPage : To Redirect Specific Pages
- EditLink : Edit Action Link
- StatusLink : Change active or inactive status Action Link
- DeleteLink : Delete Action Link
- SendMail : Send Mail method
- GetRandomString : Generate Random String
|  |  by Bharat Parmar  package author  455 - 9 years ago (2016-04-11) Comment
 This class can perform CRUD operations on MySQL table records. It can perform several types of operations with records of a given MySQL table like: 
InsertRecord : Insert Record to database
InsertMultipleRecord : Insert Multiple Records
GetSingleRecord : Retrieve Single Record for Edit or View Action
GetRecord: Get All or a limited number of Records with pagination
UpdateRecord : Edit or Update Record Method
DeleteRecord : Delete Record Method
GetCustom : For results for arbitrary queries
 The class can also generate HTML to display or update the table records like: 
PagiNation : Pagination Display
UploadFile : Upload File
DeleteFile : Delete File
DateDifference : Date Difference
RedirectPage : To Redirect Specific Pages
EditLink : Edit Action Link
StatusLink : Change active or inactive status Action Link
DeleteLink : Delete Action Link
SendMail : Send Mail method
GetRandomString : Generate Random String
 |