PHP Classes

PHP Simple CRUD with MySQL: Generate SQL and forms to perform CRUD operations

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 466 All time: 6,045 This week: 62Up
Version License PHP version Categories
php-crud-mysql 1.0.1GNU General Publi...5HTML, PHP 5, Databases
Description 

Author

This class can generate SQL and forms to perform CRUD operations.

It can take the name of a table and fields and can generate SQL INSERT, UPDATE and DELETE queries to manipulate records of that table in a MySQL database.

The class can also generate HTML to edit table record data in a Web page.

Picture of Muhammad Mahbubur Rahman
  Performance   Level  
Name: Muhammad Mahbubur Rahman <contact>
Classes: 1 package by
Country: United States United States

Example

<?php
include("crudClass.php");

$con = $crud->db_con('localhost','root','mysql','crud');// Connect Database

$crud = new crudClass('kitchen','instrument,code,type');// Initiate the class with table information

if($_POST['submit']){
   
$create_sql = $crud->create();//Fetch INSERT query
   
mysqli_query($con,$create_sql);
}
if(
$_POST['update']){
   
$update_sql = $crud->update($_POST['id']);//Fetch UPDATE query
   
mysqli_query($con,$update_sql);
}
if(
$_POST['delete']){
   
$delete_sql = $crud->delete($_POST['id']);//Fetch DELETE query
   
mysqli_query($con,$delete_sql);
}

echo
$crud->create_form();//Prepare data entry form
echo '<hr>';
echo
$crud->renderVertically();//READ and SHOW data

if($_POST['edit']){
    echo
'<hr>';
    echo
$crud->renderEditor($_POST['id']);//Prepare data edit form
}
?>


Details

How the package is useful ..

This package will make your programming easy where you just need CRUD operations.

What the package will do ..

The program will take a Table Name and Fields Name of the table as argument then provide all CRUD operations for the table.

How to use ..

Please follow the example file crud_example.php


  Files folder image Files (3)  
File Role Description
Plain text file crudClass.php Class Main class file
Accessible without login Plain text file documentation.txt Doc. Documentation
Accessible without login Plain text file crud_example.php Example Simple example to use the class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:466
This week:0
All time:6,045
This week:62Up