I am running the following query in PHP to retrieve data from MySQL database. It works fine when I give id range less than 595 or so (e.g., $low=105, $high=700). But if i increase this number, it results in "Page not found" error or simply a blank page. Can somebody please tell me why it's happening and how can I improve the query etc.? (Note: there are several thousand rows in the database. $curr_book and $new_book are arrrays containg an average of 5 names of books.) Thanks for your help.
$query = mysql_query("select id, datetime, curr_book, new_book from minitest where (id > '$low' && id < '$high')");
if ($query){
echo "
<table border=1>
<tr>
<td>No.</td>
<td>Date/Time</td>
<td>Current Books</td>
<td>New Books</td>
</tr>";
$numOfRows = mysql_num_rows ($query);
for ($i = 0; $i < $numOfRows; $i++){
$id = mysql_result ($query, $i, "id");
$datetime = mysql_result ($query, $i, "datetime");
$curr_book = mysql_result ($query, $i, "curr_book");
$new_book = mysql_result ($query, $i, "new_book");
echo "<tr>
<td>$id</td>
<td>$datetime</td>
<td>";
if ($curr_book != "") {
$curr_book = unserialize( $curr_book);
$currentbooks = implode($curr_book, ", ");
echo "$currentbooks";
}
else {
echo "—";
}
echo "</td><td>";
if ($new_book != "") {
$new_book = unserialize( $new_book);
$newbooks = implode($new_book, ", ");
echo "$newbooks";
}
else {
echo "—";
}
echo "</td></tr>";
}// end for loop
echo "</table>";
}// end if $query