Recommend this page to a friend! |
Classes of Ujah Chigozie peter | Advanced PHP MySQL Search Controller | README.md | Download |
|
![]() PHPSearchControllerPHPSearchController 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. 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 InstallationInstallation is super-easy via Composer:
UsagesInitialize the class with your preferred search method the default method is
Set your preferred search operator the default is
To perform a database search build the search query like below.
To search by tag using mysql
Set inital query and pass search query to your mysql connection
OR bulid it with other sql query like below in your mysql connection
Other MethodsReturns the computed sql search queries by checking if initial query was specified or not to determine which start clause is needed.
Returns the computed search queries by using
Returns the computed search queries by using
RefrenceSpecify search operator | Search Operators | Description | |--------------------------|-----------------------------------------------------------------------------------| | START_WITH_QUERY | Finds any values that start with "query" | | END_WITH_QUERY | Finds any values that end with "query" | | HAVE_ANY_QUERY | Finds any values that have "query" in any position | | HAVE_SECOND_QUERY | Finds any values that have "query" in the second position | | START_WITH_QUERY_2LENGTH | Finds any values that start with "query" and are at least 2 characters in length | | START_WITH_QUERY_3LENGTH | Finds any values that start with "query" and are at least 3 characters in length | | START_END_WITH_QUERY | Finds any values that start with "query" and ends with "query" | Initalise search class with a method | Search Methods | Description | |------------------------|-------------------------------------------------------------------------------------| | OR | Retrieve result with any one of search query | | AND | Retrieve result with the exact of search quer | | NAND | Retrieve result without the exact search query | | NOR | Retrieve result without any on of the search query | |