$limit=3;
include ("database.php");
// Build SQL Query
$query = "select * from video where collection='$categorie' order by id desc"; // EDIT HERE and specify your table and field names for the SQL query
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
// next determine if s has been passed to script, if not use 0
$s = (isset($_GET['s'])) ? $_GET['s'] : 0 ;
// get results
$query .= " limit $s,$limit";
$result = mysql_query($query) or die("Couldn't execute query");
// display what the person searched for
//echo "
You searched for: "" . $var . ""
";
// begin to show results set
$currPage = (($s/$limit) + 1);
//break before paging
$a = $s + ($limit) ;
if ($a > $numrows) { $a = $numrows ; }
$b = $s + 1 ;
// next we need to do the links to other results
if ($s>=1) {
$prevs=($s-$limit);
}
// calculate number of pages needing links
$pages=intval($numrows/$limit);
// $pages now contains int of pages needed unless there is a remainder from division
if ($numrows%$limit) {
// has remainder so add one page
$pages++;
}
// check to see if last page
if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {
// not last page so give NEXT link
$news=$s+$limit;
}
?>
$count = 1 + $s ;
// now you can display the results returned
while ($row= mysql_fetch_array($result)) {
$description = $row["name"];
$nid = $row["id"];
?>