1

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
  • I have done my searching part,means now i am getting my data from the database based on the search query. Commented May 13, 2015 at 8:04

1 Answer 1

2

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>

:)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.