I have a search form in php and when the user enters a name to search, form calls the following php code to give results. My problem is that this code when executed gives me "mysql_fetch_array() expects parameter 1 to be resource, boolean given". If I change the $sql to somthing like$sql = " SELECT `name`, `surname`, `email`, `user_id` FROM usersthen it works fine. Any idea where it might be my problem and how to move on?
//more code
$start=0;
$per_page=10;
$page=1;
$sql = " SELECT `name`, `surname`, `email`, `user_id` FROM users WHERE (surname LIKE '$name%' AND name LIKE '$surname%') OR (surname LIKE '$surname%' AND name LIKE '$name%') LIMIT 100 ";
$sql .= "LIMIT $start, $per_page";
$result = mysql_query($sql);
while($run = mysql_fetch_array($result)){
$surname = $run['surname'];
}