-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
23 lines (22 loc) · 717 Bytes
/
search.php
File metadata and controls
23 lines (22 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
require_once 'core/init.php';
//ajax live search implementation
if(Input::exists('get'))
{
$name=Input::get('name');
$db=DB::getInstance();
$data=$db->query("SELECT DISTINCT dr_profession FROM doctor WHERE dr_profession LIKE '".$name."%';");
$count=$data->count();
for ($i = 0; $i < $count; ++$i)
{
$arr[]=array('id'=>$data->results()[$i]->dr_profession);
}
// $arr[]=array('id'=>$data->results()[0]->dr_profession);
$arr[]=array('id'=>'Search -'.$name.'- in clinic');
$arr[]=array('id'=>'Search -'.$name.'- in lab');
$arr[]=array('id'=>'Search -'.$name.'- in doctors');
echo json_encode($arr);
// print_r($arr);
}
//data returned in json format
?>