Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple word search #9

Closed
andrejflorjancic opened this issue Dec 19, 2016 · 0 comments
Closed

Multiple word search #9

andrejflorjancic opened this issue Dec 19, 2016 · 0 comments

Comments

@andrejflorjancic
Copy link
Contributor

Try this version of function filterglobal

$searchinput = $this->input('search')['value'];
$allcolumns = $this->input('columns');

if ($searchinput == '')
{
return null;
}

$search = [];
$searchinput = preg_replace("/\W+/", " ", $searchinput);
foreach (explode(' ',$searchinput) as $word) {
$lookfor = [];
foreach ($this->columns as $key => $column) {
if ($allcolumns[$key]['searchable'] == 'true') {
$lookfor[] = $column . " LIKE " . $this->db->escape($word) . "";
}
}
$search[] = "(".implode(" OR ", $lookfor) . ")";
}

return implode(" AND ", $search);

Searches for all the words in a row.

@n1crack n1crack closed this as completed Jan 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants