I have a users table in MySQL and would like a search by name. Right now I have the following code:
Please check the below code.
0){
$query .= " WHERE "
for($i=0 ; $i < $split_words; $i++){
$query .= " name LIKE ? OR ";
}
$query = substr($query , 0, -3); //Remove last 3 characters OR with space
array_walk($split_words,"addPercentage");
$query->execute($split_words);
}else{
$query->execute();
}
$result = $query->rowCount();
echo $result;
function addPercentage(&$value,$key)
{
$value = "%".$value."%" ;
}
?>