a Create Read Update Delete Framework Created to be used for easier create read update delete
download the code and import it in your project;
include("crud.php");
// or
require("crud.php");
// or
include_once("crud.php");
based on your coding practices. make sure the file location is linked well.
$crud = new Crud($server, $username, $password, $database)
//create a variable like this
$insert = $crud->insert_data($tablename, [
"name" => $name,
"age" => $age
]);
# in the associative array, the key values should be the same as the table columns in your mysql database
//create a variable like this
$crud->fetch_data("SELECT * FROM tablename");
//other functions you can use
count();
json_encode(); // and many more
//do like this
$update = $crud->update_data($tablename, [
"name" => $name, //fields to update
"age" => $age
], [
"id" => $id // conditions criteria
])
# the keys table should ne the same as the names you gave the columns in your table
// do this way
$delete = $crud->delete_data("DELETE FROM tablename WHERE id = '1'");
this project is for beginers but experts can also check on it. it's 100% php