Updated readme with link to php.net

This commit is contained in:
Timothy Warren 2012-03-19 23:46:00 -04:00
commit 09f6a249d8
3 changed files with 23 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
test_config.json
tests/simpletest/*
index.html

View File

@ -49,6 +49,28 @@ Query uses the same interface as CodeIgniter's [Active Record class](http://code
To retreive the results of a query, use the PDO methods: [fetch](http://php.net/manual/en/pdostatement.fetch.php) and / or [fetchAll](http://php.net/manual/en/pdostatement.fetchall.php).
An example of a moderately complex query:
$query = $db->select('id, key as k, val')
->from('table t')
->where('k >', 3)
->or_where('id !=' 5)
->order_by('val', 'DESC')
->limit(3, 1)
->get();
This will generate a query similar to (with this being the output for a Postgres database):
SELECT "id", "key" AS "k", "val"
FROM "table" "t"
WHERE "k" > ?
OR "id" != ?
ORDER BY "val" DESC
LIMIT 3 OFFSET 1
To retreive the results of a query, use the PDO method [fetch](http://php.net/manual/en/pdostatement.fetch.php) and/or[fetchAll](http://php.net/manual/en/pdostatement.fetchall.php).
$query = $db->get('table_name');
$results = $query->fetchAll(PDO::FETCH_ASSOC);

Binary file not shown.