rendered paste body$criteria = preg_replace('%[^a-z]+%i', ' ', $criteria);
$criteria = array_unique(explode(' ', $criteria));
$wheres = array();
$params = array();
foreach($criteria as $crit)
{
$wheres[] = '(jobNum LIKE ? OR requestor LIKE ?
OR completedBy LIKE ? OR checkedBy LIKE ?
OR sourceName LIKE ?
)';
$params = array_merge($params, array_fill(0, 5, $crit));
}
$where = implode(' AND ', $wheres);
$sql = 'FROM dubReqs WHERE ' . $where;
$count = DB::instance()->value(
'SELECT count(*) ' . $sql, $params,
'Dubs'
);
$results = DB::instance()->results(
'SELECT * ' . $sql . ' LIMIT ' . $limit, $params,
'Dubs'
);