Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add README file

  • Loading branch information...
commit 9395258f803db06619325785e3a0ba6d1be7dadb 1 parent 374659f
@rs authored
Showing with 28 additions and 0 deletions.
  1. +28 −0 README.md
View
28 README.md
@@ -0,0 +1,28 @@
+MyDBD is a wrapper around mysqli compatible with PEAR::Db and inspired from DBI API. This
+is not an abstraction layer meant to handle several type of databases, thus the abstraction
+code overhead is very low.
+
+### Example Usage
+
+ $dbh = new MyDBD('hostname' => 'localhost'));
+ $res = $dbh->query('SELECT field1, field2 FROM table WHERE foo = ?', array('bar'));
+
+ foreach ($res as $row)
+ {
+ printf("field1: %s, field2: %s\n", $row[0], $row[1]);
+ }
+
+ $res->setFetchMode(MyDBD_ResultSet::FETCHMODE_ASSOC);
+
+ foreach ($res as $row)
+ {
+ printf("field1: %s, field2: %s\n", $row['field1'], $row['field2']);
+ }
+
+ $sth = $dbh->prepare('INSERT INTO table (field1, field2) VALUES(?, ?)');
+
+ foreach ($myData as $row)
+ {
+ $sth->execute($row[0], $row[1]);
+ }
+
Please sign in to comment.
Something went wrong with that request. Please try again.