diff --git a/readme.md b/readme.md index bd77369a..b453aa78 100644 --- a/readme.md +++ b/readme.md @@ -4,4 +4,68 @@ To utilize this class, first import MysqlDb.php into your project, and require i require_once('MysqlDb.php'); - \ No newline at end of file + + +After that, create a new instance of the class. + +
+
+$Db = new MysqlDb('host', 'username', 'password', 'databaseName');
+
+
+ +Next, prepare your data, and call the necessary methods. + +

Insert Query

+
+
+ 'Inserted title',
+    'body' => 'Inserted body'
+);
+
+if ( $Db->insert('posts', $insertData) ) echo 'success!';
+
+
+
+ +

Select Query

+ +
+
+$results = $Db->get('tableName', 'numberOfRows-optional');
+print_r($results); // contains array of returned rows
+
+
+ +

Update Query

+ +
+
+$updateData = array(
+   'fieldOne' => 'fieldValue',
+    'fieldTwo' => 'fieldValue'
+);
+$Db->where('id', int);
+$results = $Db->update('tableName', $updateData);
+
+
+ +

Delete Query

+ +
+
+$Db->where('id', integer);
+if ( $Db->delete('posts') ) echo 'successfully deleted'; 
+
+
+ +

Generic Query Method

+ +
+
+$results = $Db->query('SELECT * from posts');
+print_r($results); // contains array of returned rows
+
+