[eluser]georgerobbo[/eluser]
Hello, I'm building a basic search form which will query all fields of the database and return any matching results. I'm struggling with writing the code. This is what I currently have.
Code:
<?php
class Search extends Model {
function Search()
{
parent::Model();
}
function get_result()
{
/* Retrieve from Form */
$keyword = $_POST['keyword'];
trim ($keyword);
/* Trim (Remove White Space) */
if (!get_magic_quotes_gpc())
{
$keyword = addslashes($keyword);
}
/* Query SQL */
$this->db->select('*');
$this->db->where('tablerow like '%".$keyword."%'');
$query = $this->db->get('user');
return $query;
}
}