Skip to content

Commit 160ad28

Browse files
authored
Small typo fixes (ThingEngineer#898)
thank you. merged
1 parent db3f585 commit 160ad28

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

readme.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ MysqliDb -- Simple MySQLi wrapper and object mapper with prepared statements
1010
**[Select Query](#select-query)**
1111
**[Delete Query](#delete-query)**
1212
**[Insert Data](#insert-data)**
13-
**[Insert XML](#insert-xml)**
14-
**[Pagination](#pagination)**
13+
**[Insert XML](#insert-xml)**
14+
**[Pagination](#pagination)**
1515
**[Running raw SQL queries](#running-raw-sql-queries)**
1616
**[Query Keywords](#query-keywords)**
1717
**[Where Conditions](#where--having-methods)**
@@ -375,7 +375,7 @@ Array
375375
MysqliDb can return result in 3 different formats: Array of Array, Array of Objects and a Json string. To select a return type use ArrayBuilder(), ObjectBuilder() and JsonBuilder() methods. Note that ArrayBuilder() is a default return type
376376
```php
377377
// Array return type
378-
$= $db->getOne("users");
378+
$u= $db->getOne("users");
379379
echo $u['login'];
380380
// Object return type
381381
$u = $db->ObjectBuilder()->getOne("users");
@@ -395,21 +395,21 @@ To avoid long if checks there are couple helper functions to work with raw query
395395

396396
Get 1 row of results:
397397
```php
398-
$user = $db->rawQueryOne ('select * from users where id=?', Array(10));
398+
$user = $db->rawQueryOne('SELECT * from users where id=?', Array(10));
399399
echo $user['login'];
400400
// Object return type
401-
$user = $db->ObjectBuilder()->rawQueryOne ('select * from users where id=?', Array(10));
401+
$user = $db->ObjectBuilder()->rawQueryOne('SELECT * from users where id=?', Array(10));
402402
echo $user->login;
403403
```
404404
Get 1 column value as a string:
405405
```php
406-
$password = $db->rawQueryValue ('select password from users where id=? limit 1', Array(10));
406+
$password = $db->rawQueryValue('SELECT password from users where id=? limit 1', Array(10));
407407
echo "Password is {$password}";
408408
NOTE: for a rawQueryValue() to return string instead of an array 'limit 1' should be added to the end of the query.
409409
```
410410
Get 1 column value from multiple rows:
411411
```php
412-
$logins = $db->rawQueryValue ('select login from users limit 10');
412+
$logins = $db->rawQueryValue('SELECT login from users limit 10');
413413
foreach ($logins as $login)
414414
echo $login;
415415
```
@@ -438,7 +438,7 @@ print_r ($results); // contains Array of returned rows
438438
### Where / Having Methods
439439
`where()`, `orWhere()`, `having()` and `orHaving()` methods allows you to specify where and having conditions of the query. All conditions supported by where() are supported by having() as well.
440440

441-
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.
441+
WARNING: In order to use column to column comparisons only raw where conditions should be used as column name or functions cannot be passed as a bind variable.
442442

443443
Regular == operator with variables:
444444
```php
@@ -523,7 +523,7 @@ $results = $db->get("users");
523523
Or raw condition with variables:
524524
```php
525525
$db->where ("(id = ? or id = ?)", Array(6,2));
526-
$db->where ("login","mike")
526+
$db->where ("login","mike");
527527
$res = $db->get ("users");
528528
// Gives: SELECT * FROM users WHERE (id = 6 or id = 2) and login='mike';
529529
```
@@ -614,13 +614,14 @@ $results = $db->get ('users');
614614
// Gives: SELECT * FROM users GROUP BY name;
615615
```
616616

617-
Join table products with table users with LEFT JOIN by tenantID
618617
### JOIN method
618+
Join table products with table users with LEFT JOIN by tenantID
619619
```php
620620
$db->join("users u", "p.tenantID=u.tenantID", "LEFT");
621621
$db->where("u.id", 6);
622622
$products = $db->get ("products p", null, "u.name, p.productName");
623623
print_r ($products);
624+
// Gives: SELECT u.name, p.productName FROM products p LEFT JOIN users u ON p.tenantID=u.tenantID WHERE u.id = 6
624625
```
625626

626627
### Join Conditions
@@ -630,7 +631,7 @@ $db->join("users u", "p.tenantID=u.tenantID", "LEFT");
630631
$db->joinWhere("users u", "u.tenantID", 5);
631632
$products = $db->get ("products p", null, "u.name, p.productName");
632633
print_r ($products);
633-
// Gives: SELECT u.login, p.productName FROM products p LEFT JOIN users u ON (p.tenantID=u.tenantID AND u.tenantID = 5)
634+
// Gives: SELECT u.name, p.productName FROM products p LEFT JOIN users u ON (p.tenantID=u.tenantID AND u.tenantID = 5)
634635
```
635636
Add OR condition to join statement
636637
```php
@@ -650,11 +651,11 @@ $db->where ("active", true);
650651

651652
$customers = $db->copy ();
652653
$res = $customers->get ("customers", Array (10, 10));
653-
// SELECT * FROM customers where agentId = 10 and active = 1 limit 10, 10
654+
// SELECT * FROM customers WHERE agentId = 10 AND active = 1 LIMIT 10, 10
654655

655656
$cnt = $db->getValue ("customers", "count(id)");
656657
echo "total records found: " . $cnt;
657-
// SELECT count(id) FROM users where agentId = 10 and active = 1
658+
// SELECT count(id) FROM customers WHERE agentId = 10 AND active = 1
658659
```
659660

660661
### Subqueries
@@ -713,11 +714,11 @@ print_r ($products);
713714
### EXISTS / NOT EXISTS condition
714715
```php
715716
$sub = $db->subQuery();
716-
$sub->where("company", 'testCompany');
717-
$sub->get ("users", null, 'userId');
717+
$sub->where("company", 'testCompany');
718+
$sub->get ("users", null, 'userId');
718719
$db->where (null, $sub, 'exists');
719720
$products = $db->get ("products");
720-
// Gives SELECT * FROM products WHERE EXISTS (select userId from users where company='testCompany')
721+
// Gives SELECT * FROM products WHERE EXISTS (SELECT userId FROM users WHERE company='testCompany')
721722
```
722723

723724
### Has method
@@ -744,7 +745,7 @@ if (!$db->ping())
744745
```
745746

746747
Get last executed SQL query:
747-
Please note that function returns SQL query only for debugging purposes as its execution most likely will fail due missing quotes around char variables.
748+
Please note that this method returns the SQL query only for debugging purposes as its execution most likely will fail due to missing quotes around char variables.
748749
```php
749750
$db->get('users');
750751
echo "Last executed query was ". $db->getLastQuery();

0 commit comments

Comments
 (0)