This question already has an answer here:
I've been writing a php code for a search engine, and I thought my query is fine, but I'm stuck for hours instead because it says: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in ..... on line 129,
Code:
if(isset($_POST['hanapin'])){
$staff = "select e_id,e_fname,e_mi,e_lname,e_fin_cm,department,job
from employees where ".$_POST['tableya']."
like ".$_POST['whatever']."% order by e_lname"; //line 129
$result = mysql_query($staff);
while($staff_rows = mysql_fetch_array($result)){
echo "
<tr>
<td>".$staff_rows['e_id']."</td>
<td>".htmlspecialchars_decode($staff_rows['e_lname'])."</td>
<td>".htmlspecialchars_decode($staff_rows['e_fname'])."</td>
<td>".htmlspecialchars_decode($staff_rows['e_mi'])."</td>
<td>".htmlspecialchars_decode($staff_rows['e_fin_cm'])."</td>
<td>".htmlspecialchars_decode($staff_rows['department'])."</td>
<td>".htmlspecialchars_decode($staff_rows['job'])."</td>
</tr>
";
}
}
Help will be much appreciated.
</div>