howdy,
I have a script here that does a search the results are set to display 10 at a time, then when next is hit is supposed to display the next 10 items, it works fine on the first page but won't display any after that can someone please take a look and see if you can see what I am doing wrong.

thanks. the code is below.

Code:
<? session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>pagination script</title>
<!--
-->

</head>

<body>
<table>

<form method="post">
<select name="first">
<option value="mens">Men's</option>
<option value="ladies">Women's</option>
<option value="kids">Kid's</option></select>
<tr><td><input name="lookup" type="text" maxlength="50" /></td><td>Please Enter What You Are Searching For Here</td></tr>
<!--<tr><td><select name="display_num" >
  <option>10</option><option>20</option><option>50</option><option>100</option>
</select></td><td>Please Enter the Number of Items to Display on one Page(Default = 10)</td></tr>
<tr><td><select name="sort" ><option>ASC</option><option >DESC</option></select></td><td>Please Enter How You Would Like The Results Sorted.(ASC=Lowest Price First, DESC=Highest Price First)</td></tr>-->
<tr><td><input name="submit" type="submit" value="Click Here To Search" /></td></tr>  
</form>
</table>
<?php 
$page = (!isset($_GET['page']))? 1 : $_GET['page'];  
$submit= $_POST["submit"];
$lookup = $_POST["lookup"];
$first = $_POST["first"];
$disnum = $_POST["display_num"];
$lookup = $first." ".$lookup;
//$sort='';
$_SESSION['lookup']=$lookup;
$_SESSION['disnum']=$disnum;
if(isset($submit)){
$lookup=stripslashes($lookup);
$lookup = strtolower($lookup);
$lookup=ltrim($lookup);
$lookup=rtrim($lookup);
$lookup = explode(' ',$lookup);
$count=count($lookup);
// setup result sort variable
$disnum = "10";
$sort = ASC;
echo"<table border='1' width='90%'>";
 // Set current, prev and next page  
$prev = ($page - 1); 
$next = ($page + 1); 
$_SESSION['prev']=$prev;
$_SESSION['next']=$next;
//Max results per page 
$max_results = $disnum; 
// Calculate the offset 
$from = (($page * $max_results) - $max_results); 
$from=$_SESSION['from'];

$dbh=MySQL_connect ("localhost", "user", "password")
       or die ('I cannot connect to the database because: ' . mysql_error());
          mysql_select_db ("apparrell");
// Query the db for total results. 

$query ="SELECT * FROM stuff ";
if($count > 0){
$query .= "WHERE "; 
}
for($i=0; $i < $count; $i++){
$query .= " searchdata  LIKE ('% $lookup[$i] %') AND ";
}
$query = substr( $query, 0, (strlen($query)-5)); 
$result=mysql_query($query);
$total_results = mysql_num_rows($result); 
echo $total_results." Items found that matched your search.<br>";

$total_pages = ceil($total_results / $max_results); 

$pagination = ''; 

//Create a PREV link if there is one  
if($page > 1){ 
    $pagination .= '<a href="search3.htm?page='.$prev.'">Previous</a>&nbsp; '; 
}


// Print NEXT link if there is one  
if($page < $total_pages){ 
    $pagination .= '<a href="search3.htm?page='.$next.'">Next</a>&nbsp;'; 
} 
$from2=0;
// Below is how you query the db for ONLY the results for the current page *
//$query=("SELECT * FROM stuff WHERE searchdata LIKE ('%$lookup%') ORDER BY PRICE $sort LIMIT $from2, $max_results"); 
$query="SELECT * FROM stuff ";
if($count > 0){
$query .= " WHERE ";
}
for($i = 0; $i < $count; $i++){
$query .=" searchdata  LIKE ('% $lookup[$i] %') AND ";
}
$query = substr($query, 0, (strlen($query)-5)); 
$query .= " ORDER BY PRICE $sort LIMIT $from2, $max_results";
$result=mysql_query($query);
$rows=mysql_num_rows($result);
    //Generates the list of chapters 
	 echo "<tr><td>".NAME."</td><td>".PRICE."</td>"."<td>".DESCRIPTION."</td><td>"."</td><tr>";
    while($data1 = mysql_fetch_array($result)) { 
  extract($data1,EXTR_OVERWRITE);
 
		 echo "<tr><td>".$NAME."</td><td>".$PRICE."</td>"."<td>".$DESCRIPTION."</td><td>"."<img src=$IMAGEURL>"."</td><tr>";
}}
echo $pagination;  
echo"</table>";

 ?>
</body>
</html>