diff options
author | Indieteq <admin@indieteq.com> | 2012-11-13 21:44:19 +0100 |
---|---|---|
committer | Indieteq <admin@indieteq.com> | 2012-11-13 21:44:19 +0100 |
commit | 31d11e0a8d6331f73a8ac14510f5ee4ae5cc1d74 (patch) | |
tree | 51be05c5ef585a3fc74618e202d8065d44dd3cc7 | |
parent | 39f97f683cd1a15ce88f11de636c03589a70a3df (diff) | |
download | php-mysql-pdo-database-class-31d11e0a8d6331f73a8ac14510f5ee4ae5cc1d74.zip php-mysql-pdo-database-class-31d11e0a8d6331f73a8ac14510f5ee4ae5cc1d74.tar.gz php-mysql-pdo-database-class-31d11e0a8d6331f73a8ac14510f5ee4ae5cc1d74.tar.bz2 |
Update README.md
-rw-r--r-- | README.md | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -37,7 +37,8 @@ If you want to use these files you''ll have to modify the rights of the logs fol ## Examples -| Id | Firstname | Lastname | Sex | Age +#### The table persons, +| id | Firstname | Lastname | Sex | Age |:-----------:|:------------:|:------------:|:------------:|:------------:| | 1 | John | Doe | M | 19 | 2 | Bob | Black | M | 41 @@ -45,7 +46,7 @@ If you want to use these files you''ll have to modify the rights of the logs fol | 4 | Kona | Khan | M | 14 | 5 | Kader| Khan | M | 56 -#### Fetching from the database: +#### Fetching everything from the table ```php <?php // Fetch whole table @@ -72,7 +73,7 @@ This method always returns only 1 row. ```php <?php // Fetch a row -$ages = $db->row("SELECT * FROM Persons"); +$ages = $db->row("SELECT * FROM Persons WHERE id = :id", array("id"=>"1")); ``` #### Fetching Single Value: This method returns only one single value of a record. @@ -83,7 +84,7 @@ $db->bind("id","3"); $firstname = $db->single("SELECT firstname FROM Persons WHERE id = :id"); echo $firstname; -// Wicky +// Zoe ``` #### Fetching Column: ```php @@ -116,7 +117,7 @@ The easyCRUD is a class which you can use to easily execute basic SQL operations It uses the database class I've created to execute the SQL queries. ## How to use easyCRUD -#### 1. First, Create a new class. Then require the easyCRUD class. +#### 1. First, create a new class. Then require the easyCRUD class. #### 2. Extend your class and add the following fields to the class. ```php <?php |