How do I add pagination to my search script

i have a search script to search a database of books… some results become too long so i thought of adding a pagination but dont understand how to go about it.
below is my search script can anyone help me on how to add a functional paination?


if (!isset($_GET['Submit'])) { 
// form not submitted 
else {

//Server Variables 
$host = "localhost"; 
$user = "userName"; 
$pass = "passWord"; 
$db = "databaseName";

$search = empty($_GET['search'])? die ("<font size='5'font color='#FF0E0E'>ERROR: Enter Search Criteria</font>") : mysql_real_escape_string($_GET['search']); 
$dropdown = empty($_GET['dropdown'])? die ("<font size='5'font color='#FF0E0E'>ERROR: Select from Dropdown</font>") : mysql_real_escape_string($_GET['dropdown']);

echo "<font size='5'font color='#FF0E0E'><strong>Search term too short!</strong></font>";
echo "<font size='5'font color='#FF0E0E'>You searched for <strong>$search</strong></font></br></br>";

//Open Connection
$connect = mysql_connect($host, $user, $pass) or die ("Unable to connect to host");

//Select Database
mysql_select_db($db) or die ("Unable to connect to database");

//Create Query
$query = "SELECT DISTINCT book_id,call_no,main_title,author1,itm_type,publdate,image,subj1 FROM records WHERE $dropdown LIKE '%$search%' order by publdate" or die (mysql_error());

$result = mysql_query($query) or die (mysql_error());




if ($num==0)
echo "Sorry, there are no matching results for <b>$search</b>.</br></br>1. 
Try more general words. </br>2. Please check your spelling";
echo "<font size='4'font color='#FF0E0E'><strong>$num</strong> results found!</font><p>";


while ($i < $num) {


echo "<table id='results'>";
echo "
<tr><td><img src='image1/$image' alt='Image not found' onError=this.onerror=null;this.src='image1/default.jpg' height='110px' width='90px'></td><td valign='top'><b><a href=details.php?id=$book_id>
<b>By:</b> $author1<br>
<b>Call no:</b> $call_no<br>
<b>Type:</b> $itm_type<br>
<b>Year:</b> $publdate</tr><p>
<hr color='#7dd5f5' size='1'></br>



Order your query and use a counter to keep track of where you are in the results.

Try ready made class for php pagination,

Where you have your query string, use LIMIT

“$query = “SELECT DISTINCT book_id,call_n…” LIMIT 0,10”; – see if a page is set or not to display the first 10 rows, then you can get the page number from the URL such as (website_url?page=2) "LIMIT ".$_GET[‘page’]-1.“0 10”; this will print “LIMIT 10 10” thus getting the next 10 rows.

Best finding yourself a decent guide on the interweb to help with validation though…