Contains simple search form which searches and displays the rows from the database.
Written in simple PHP and ajax suitable for smaller applications
- Copy the following line to the page you are working on
<input type="text" id="ls_search_text" placeholder="Type any keyword to search"/>
- Copy the folder
live_search_assetsto your project folder. - Include the following lines in the page where you want the search bar
<script src="live_search_assets/js/ls.js"></script>
<link href="live_search_assets/css/ls.css" rel="stylesheet" />
- Edit the
config.phpfile in the live-search-assets folder according to your needs.
| Name | Type | Required | Description |
|---|---|---|---|
| servername | String | Yes | Database host. Ex.localhost. |
| username | String | Yes | MySQL database username. |
| password | String | Yes | MySQL database password. |
| db_name | String | Yes | MySQL database name. |
| table_name | String | Yes | MySQL database tablename. |
| search_columns | array | optional | Enter the name of the columns to be searched (or) Leave as it is for searching all columns.Separate columns by comma's enclosed within quotes Ex.==> $search_columns=array('eid','ename') |
| output_columns | array | optional | Enter the name of the columns to be displayed (or) Leave as it is for displaying all columns.Separate columns by comma's enclosed within quotes Ex.==> $output_columns=array('eid','ename') |
| output_columns_name | array | optional | Name of the output columns Ex.==>$output_columns_name=array('Employee ID','Employee Name'); or leave it empty for using the db columns name |
| use_sno | Boolean | Yes | Displays the serial number. Make it to false if you dont need serial numbers |
- IE 8+
- Chrome
- Firefox
- Opera
- Safari