Skip to content

Commit cd648db

Browse files
authored
Update README.md
1 parent b25171e commit cd648db

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# PHPSearchController
22

3-
PHPSearchController is a simple php class to search mysql database, it can build SQL query to perform MySQL database searches by takeing parameters that define database table fields and field values to search.
3+
PHPSearchController is a simple PHP class to search MySQL database, it can build SQL queries to perform MySQL database searches by taking parameters that define database table fields and field values to search.
44

5-
The class generates SQL conditions used to build SQL queries to perform database searches for records that match the criteria based on the table fields and field values defined by the parameters, It then combine several conditions using SQL operators such as `AND, OR, NAND, LIKE NOR & FIND_IN_SET` and return the appropriate queries for the search.
5+
The class generates SQL conditions used to build SQL queries to perform database searches for records that match the criteria based on the table fields and field values defined by the parameters, It then combines several conditions using SQL operators such as `AND, OR, NAND, LIKE NOR & FIND_IN_SET` and return the appropriate queries for the search.
66

77
## Installation
88

@@ -25,7 +25,7 @@ Set your preferred search operator the default is `SearchController::END_WITH_QU
2525
$search->setOperators(SearchController::HAVE_ANY_QUERY);
2626
```
2727

28-
To perform a database search build the search query like below.
28+
To perform a database search, you can just build your search query like the one below.
2929

3030
```php
3131
$searchQuery = "PHP Code";
@@ -38,15 +38,16 @@ $search->setParameter(array(
3838
//var_export($search->getQuery());
3939
```
4040

41-
To search by tag using mysql `FIND_IN_SET`, build query like example below.
41+
To search by tag using MySQL `FIND_IN_SET`, build a query like the example below.
42+
4243
```php
4344
$searchQuery = "PHP Code";
4445
$search->setQuery($searchQuery)->split();
4546
$search->setTags("code_tags");
4647
//var_export($search->getQuery());
4748
```
4849

49-
Set inital query and pass search query to your mysql connection
50+
Set the initial query and pass the search query to your MySQL connection
5051

5152
```php
5253
$search->setIniQuery("SELECT * FROM code WHERE id = 1323");
@@ -55,11 +56,12 @@ $db->conn()->execute();
5556
$result = $db->conn()->getAll();
5657
$db->conn()->free();
5758
```
58-
OR bulid it with other sql query like below in your mysql connection
59+
60+
OR build it with other sql queries like the below in your MySQL connection
5961
```php
6062
$db->conn()->prepare("
6163
SELECT * FROM code
62-
{$search->getWhereQuery()}
64+
{$search->getQuery()}
6365
AND id = 1323
6466
");
6567
$db->conn()->execute();
@@ -69,7 +71,7 @@ $db->conn()->free();
6971

7072
# Other Methods
7173

72-
Returns the computed sql search queries by checking if initial query was specified or not to determine which start clause is needed.
74+
Returns the computed sql search queries by checking if the initial query was specified or not to determine which start clause is needed.
7375
```php
7476
$search->getQuery()
7577
```
@@ -80,19 +82,19 @@ Set your search keyword
8082
$search->setQuery("Foo Bar")
8183
```
8284

83-
Split search keyword `Foo Bar` into `Foo`, `Bar` as separate search terns
85+
Split search keyword `Foo Bar` into `Foo`, `Bar` as separate search terms
8486
```php
8587
$search->split()
8688
```
8789

88-
Mapping your database column keys to perform search on
90+
Mapping your database column keys to perform a search on
8991

9092
```php
9193
$search->setParameter(array)
9294
```
9395

9496

95-
Set initial SQL query before appending search after your query string
97+
Set the initial SQL query before appending the search after your query string
9698

9799
```php
98100
$search->setIniQuery('SELECT * FROM ...')

0 commit comments

Comments
 (0)