I want to show my search output in a table using Codeigniter. Suppose if user wants to search all the volunteers of his location then the result should be shown in a table containing volunteer name,conatct no etc. Any kind of help will be realy appreciable.
1 Answer
You can use the CI active record class: http://www.codeigniter.com/userguide2/database/active_record.html#select
<table>
<tr>
<th>Name</th>
<th>contact</th>
</tr>
<?php
$query = $this->db->get_where('mytable', array('feild_to_search' => 'search_query'));
foreach ($query->result() as $row)
{
?>
<tr>
<td><?php echo $row->name ?></td>
<td><?php echo $row->contact ?></td>
</tr>
<?php
}
?>
</table>
:)