Forum Moderators: coopster
The problem is that now (after posting I need to build the qry and I need a loop, but I can't find a loop that will manage the "OR" statements.
i.e.
$query = "SELECT * FROM `db1`.`tbl1`
WHERE
`f1` LIKE '%$searchCriteria%'
OR `f2` LIKE '%$searchCriteria%'
OR `f20` LIKE '%$searchCriteria%'
OR `f29` LIKE '%$searchCriteria%'
LIMIT 0 , 999";
Can anyone point my dumb a** in the right direction?
Any help Appreciated,
HotShot1
Best to have your checkboxes as an array, then loop through them. Like this:
<input type="checkbox" name="search[]">
for ($i=0; $i<count($_POST['search']); $i++)
{
if ($i)
{
$sql .= "OR somefield LIKE '%$searchCriteria%' ";
}
else
{
$sql = "WHERE somefield LIKE '%$searchCriteria%' ";
}
}
Then use $sql in your query.
$query = "SELECT * FROM `db1`.`tbl1` $sql";
Hope that gives you a starting point.
dc