how to implement search in codeigniter

$_searchfield = $_REQUEST[‘key’]; $_searchfield = str_replace(“‘”, “”, $_searchfield); $query = $this->db->query(“SELECT * FROM td_product WHERE active=1 AND product_code like ‘$_searchfield’ UNION SELECT * FROM td_product WHERE active=1 AND product_title like ‘%$_searchfield%’ UNION SELECT * FROM td_product WHERE active=1 AND product_keyword like ‘%$_searchfield%’ UNION SELECT * FROM td_product WHERE active=1 AND product_desc like ‘%$_searchfield%’ limit 20”); … Read morehow to implement search in codeigniter

How to search data from table in php

———both HTML and php code in s1.php file—————- <form method=”post” action=”s1.php?go” id=”searchform”> <input type=”text” name=”name”> <input type=”submit” name=”submit” value=”Search”> </form>   <?php if (isset($_POST[‘submit’])) { //connect to the database $db = mysql_connect(“localhost”, “root”, “”) or die(‘I cannot connect to the database because: ‘ . mysql_error()); //-select the database to use $mydb = mysql_select_db(“database_name”);if (isset($_GET[‘go’])) {if … Read moreHow to search data from table in php