Skip to content

Commit 2fedec8

Browse files
author
Indieteq
committed
Update README.md
1 parent 3326095 commit 2fedec8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ If you want to use these files you''ll have to modify the rights of the logs fol
5252
// Fetch whole table
5353
$persons = $db->query("SELECT * FROM persons");
5454
```
55-
#### Fetching with Bindings:
55+
#### Fetching with Bindings (ANTI-SQL-INJECTION):
56+
Binding parameters is the best way to prevent SQL injection. The class prepares your SQL query and binds the parameters
57+
afterwards.
58+
5659
There are three different ways to bind parameters.
5760
```php
5861
<?php
@@ -136,7 +139,11 @@ Here an example :
136139
```php
137140
<?php
138141
// Fetch style as third parameter
139-
$persons_num = $db->query("SELECT * FROM Persons", null, PDO::FETCH_NUM);
142+
$person_num = $db->row("SELECT * FROM Persons WHERE id = :id", array("id"=>"1"), PDO::FETCH_NUM);
143+
144+
print_r($person_num);
145+
// Array ( [0] => 1 [1] => Johny [2] => Doe [3] => M [4] => 19 )
146+
140147
```
141148
More info about the PDO fetchstyle : http://php.net/manual/en/pdostatement.fetch.php
142149

@@ -150,7 +157,8 @@ Actually it's just a little ORM class.
150157

151158
## How to use easyCRUD
152159
#### 1. First, create a new class. Then require the easyCRUD class.
153-
#### 2. Extend your class and add the following fields to the class.
160+
#### 2. Extend your class to the base class Crud and add the following fields to the class.
161+
#### Example class :
154162
```php
155163
<?php
156164
require_once("easyCRUD.class.php");

0 commit comments

Comments
 (0)