Welcome Guest, Not a member yet? Register   Sign In
Help me add pagination in Search engine
#1

[eluser]Unknown[/eluser]
Hello everyone! I am creating a search engine in my blog but I can't count the record and set the pagination. Help me @@
Here is my model
function timkiem($total_pages)
{
$match = $this->input->get('search');
$this->db->like('title',$match);
$this->db->or_like('author',$match);

$timkiem=$this->db->get('entries');
return $timkiem->result();

}

My controller
{

$this->load->model('test');
$data['timkiem'] = $this->test->timkiem($total_pages);

echo $total_pages;

$this->load->view('books', $data);

}
My view
<html>
<body>

<form name="input" action="" method="get">
<input type="text" name='search' />
<input type="submit" value="Search" />
</form>
Search template
<?php echo anchor('blog','Back to blog')?>

<table>
<tr> <th>Title </th> <th>Author</th> </tr>
&lt;?php foreach($timkiem as $item):?&gt;
<tr>
<td>&lt;?php echo anchor('blog/view/'.$item->id , $item->title )?&gt;</td>
<td>&lt;?php echo $item->author?&gt;</td>

</tr>
&lt;?php endforeach;?&gt;
</table>
&lt;/body&gt;
&lt;/html&gt;

Thanks a lot everyone@@




Theme © iAndrew 2016 - Forum software by © MyBB