AshrafHefny / crud-mysql-wrapper

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.


Languages

Language:PHP 100.0%