Commit 1088c23f authored by Alexander Butenko's avatar Alexander Butenko

Readme update

parent 05c2463e
To utilize this class, first import Mysqldbi.php into your project, and require it. ### Contents
<a href="#initialization">Initialization</a>
<a href="#insert-query">Insert Query</a>
<a href="#update-query">Update Query</a>
<a href="#select-query">Select Query</a>
<a href="#delete-query">Delete Query</a>
<a href="#generic-query-method">Generic Query Method</a>
<a href="#raw-query-method">Raw Query Method</a>
<a href="#where-method">Where Method</a>
<a href="#ordering-method">Ordering method</a>
<a href="#grouping-method">Grouping method</a>
<a href="#join-method">JOIN method</a>
<a href="#properties-sharing">Properties sharing</a>
<a href="#subqueries">Subqueries</a>
<a href="#helper-commands">Helper commands</a>
<a href="#transaction-helpers">Transaction helpers</a>
### Initialization
To utilize this class, first import MysqliDb.php into your project, and require it.
```php ```php
require_once('Mysqlidb.php'); require_once('Mysqlidb.php');
...@@ -122,9 +140,10 @@ print_r($results); // contains Array of returned rows ...@@ -122,9 +140,10 @@ print_r($results); // contains Array of returned rows
### Where Method ### Where Method
This method allows you to specify the parameters of the query. This method allows you to specify where parameters of the query.
WARNING: In order to use column to column comparisons only raw where conditions should be used as column name or functions cant be passed as a bind variable.
Regular == operator: Regular == operator with variables:
```php ```php
$db->where('id', 1); $db->where('id', 1);
$db->where('login', 'admin'); $db->where('login', 'admin');
...@@ -132,6 +151,16 @@ $results = $db->get('users'); ...@@ -132,6 +151,16 @@ $results = $db->get('users');
// Gives: SELECT * FROM users WHERE id=1 AND login='admin'; // Gives: SELECT * FROM users WHERE id=1 AND login='admin';
``` ```
Regular == operator with column to column comparison:
```php
// WRONG
$db->where('lastLogin', 'createdAt');
// CORRECT
$db->where('lastLogin = createdAt');
$results = $db->get('users');
// Gives: SELECT * FROM users WHERE lastLogin = createdAt;
```
```php ```php
$db->where('id', 50, ">="); $db->where('id', 50, ">=");
// or $db->where('id', Array('>=' => 50)); // or $db->where('id', Array('>=' => 50));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment