https://github.com/ikcede/php-search
A Basic Search API for PHP
https://github.com/ikcede/php-search
Last synced: about 1 month ago
JSON representation
A Basic Search API for PHP
- Host: GitHub
- URL: https://github.com/ikcede/php-search
- Owner: ikcede
- Created: 2013-01-30T20:50:16.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-02-19T02:25:07.000Z (over 13 years ago)
- Last Synced: 2025-01-17T03:12:15.274Z (over 1 year ago)
- Language: PHP
- Size: 125 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
php-search
==========
A Basic Search API for PHP
v. 0.2
Set up for a basic search API with a Search Model capable of constructing complex queries
for a mysql database.
As of v. 0.2,
- Support for int queries (fixed a bug where >, <, etc. didn't work)
- Wildcards for LIKE queries (using *)
- Query limit
- Searches on multiple tables, all through one php file
- Returns empty on expressionless search (because we don't want people accidentally getting the whole table)
Installation:
1. Configure the search database with your username and password (go to Models/dbconfig.mysql.php)
2. Go to search.php:
$all_fields = array(
);
...
...
$search = new Search("test",$limit);
There, add fields and change the parameter "test" to your table name.
Now you can make GET requests to .../search.php and it will search your database and return a JSON.
Ex. $.get(".../search.php",{id:"0"},function(html) {alert(html)});
Where fields is configured $fields = array("id"=>"="); will return rows in the table where id = 0
Param: search_type -- will define which table you're searching on and the fields and operators used
limit -- will define the limit of search