Skip to content

Create, Read, Update, Delete wrapper for MySQL. Simple, easy to use class using PDO for simplifing redundant MySQL connections and methods.

Notifications You must be signed in to change notification settings

AshrafHefny/crud-mysql-wrapper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 

Repository files navigation

C.R.U.D. MySQL Wrapper

Create, Read, Update, Delete wrapper for MySQL. Simple, easy to use class using PDO for simplifing redundant MySQL connections and methods.

How To Use

Instantiating the Class

$crud = crud::obtain('localhost', 'databaseUsername', 'databasePassword', 'databaseName');

Reading Table

$result = $crud->query("SELECT * FROM your_table");
print_r($result);

Inserting new data in a table

$data['firstname'] = 'Jack';
$data['lastname'] = 'Jones';
$crud->insert('your_table', $data);

Updating data

$data['firstname'] = 'Joe';
$data['lastname'] = 'Mama';
$crud->update('your_table', $data, 'user_id=4');

Deleting row

$crud->delete('your_table', 'id=123');

Truncate table

Empties all data from the table.

$crud->truncate('your_table');

Drop table

Completely deletes the table.

$crud->drop('your_table');

About

Create, Read, Update, Delete wrapper for MySQL. Simple, easy to use class using PDO for simplifing redundant MySQL connections and methods.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%