I am building a mini test php thing. And I need to be able to search the results. This works great. But I cannot seem to make a paging system around this. I sort of know how to make a paging system, however, I cannot seem to do this because the mysql query is not only searching the table records which idedu_details is equal to $edu_details:
$search_result = mysql_query("SELECT * FROM test WHERE idedu_details='".$edu_details."' AND first_name LIKE '%".$search."%' OR surname LIKE '%".$search."%'");
here is my complete code:
$search_result = mysql_query("SELECT * FROM test WHERE idedu_details='".$edu_details."' AND first_name LIKE '%".$search."%' OR surname LIKE '%".$search."%'");
while($row_search = mysql_fetch_array($search_result)){
$idedu_detail_check = mysql_query("SELECT * FROM test WHERE idtest='".$row_search['idtest']."'") or die(mysql_error());
$row_idedu_check = mysql_fetch_array($idedu_detail_check);
if($row_idedu_check['idedu_details'] == $edu_details){
$testid = $row_search['idtest'];
$firstName = $row_search['first_name'];
$surname = $row_search['surname'];
$dob = $row_search['dob'];
$date = $row_search['date'];
$status = $row_search['status'];
$link = "report.php?id=$testid";
$button = '<button onClick="parent.location='. "'".$link."'".'">Analyse</button>';
echo "<tr>
<td width='100'>$firstName</td>
<td width='100'>$surname</td>
<td width='100'>$dob</td>
<td width='100'>$date</td>
<td width='100'>$status</td>
<td width='100'>$button</td>
</tr>";
}//end if idedu_detail check
}//end while
}//end else search != null
How can I make a paging system around this?
EDIT: I know how to make a general paging system. However, checking the ided_details = $edu_details and building a paging system around this is causing an issue.