01.
<?php
02.
class
cCuslist
extends
CI_Controller{
03.
public
function
__construct(){
04.
parent::__construct();
05.
}
06.
public
function
index(){
07.
08.
$this
->load->view(
'wCsearch'
);
09.
}
10.
11.
function
fetch()
12.
{
13.
14.
$output
=
''
;
15.
$query
=
''
;
16.
$this
->load->model(
'mCuslist'
);
17.
18.
if
(
$this
->input->post(
'query'
))
19.
{
20.
$query
=
$this
->input->post(
'query'
);
21.
}
22.
$data
=
$this
->mCuslist->fetch_data(
$query
);
23.
24.
$output
.= '
25.
<div
class
=
"table-responsive"
>
26.
<table
class
=
"table table-bordered table-striped"
>
27.
<tr>
28.
<th>CstID</th>
29.
<th>Customer Name</th>
30.
</tr>
31.
';
32.
33.
if
(
is_array
(
$data
) == 1){
34.
foreach
(
$data
as
$key
=>
$row
)
35.
{
36.
$output
.= '
37.
<tr>
38.
<td>
'.$row->FNCstID.'
</td>
39.
<td>
'.$row->FTCstName.'
</td>
40.
</tr>
41.
';
42.
}
43.
}
else
{
44.
$output
.= '<tr>
45.
<td colspan=
"5"
>No Data Found</td>
46.
</tr>';
47.
}
48.
$output
.=
'</table>'
;
49.
echo
$output
;
50.
}
51.
52.
}
53.