You want to look into MySQL's LIMIT clause. There are quite a few scripts as examples in the code archives:
http://php.net/links.php -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Mick Fitzpatrick <[EMAIL PROTECTED]> Newsgroups: php.general To: <[EMAIL PROTECTED]> Sent: Friday, October 05, 2001 11:18 AM Subject: next and previous links > Hello > > After several days of reading various articles on the web I've 'finally' got > a basic database working. The database is for a massive collection of my > vinyl records. Therefore I would like to limit the results to about 20 per > page and move forward/backward with 'next' and 'previous' links. > > I'd like to stress at this stage that I'm new to PHP and don't really know > and 'tech speak' related to it ... however I like to think I'm a quick > learner :-) > > Below I've pasted a copy of the script I fashioned ... I suppose it's full > of mistakes but it does work! > > Any assistance will be appreciated > > TIA ... Mick > > *********************************** > > <html> > <body> > > <table border="1" width="100%" cellspacing="0"><TR><TH><font > face=Arial>artists</TH><TH><font face=Arial>aside</TH><TH><font > face=Arial>bside</TH><TH><font face=Arial>label</TH><TH><font > face=Arial>number</TH><TH><font face=Arial>price</TH><TH><font > face=Arial>origin</TH><TH><font face=Arial>format</TH><TH><font > face=Arial>info</TH></TR> > > > <?php > > file://THIS BLOCK IS THE MySQL DATABASE INFO AND LOCATION > mysql_connect ("xxxxxxxxxxxxxxx", "xxxxxc", "xxxxxx"); > mysql_select_db ("xxxxxx"); > > if ($artists == "") > {$artists = '%';} > > if ($aside == "") > {$aside = '%';} > > if ($bside == "") > {$bside = '%';} > > if ($label == "") > {$label = '%';} > > if ($number == "") > {$number = '%';} > > > file://THIS ROW SETS THE SEARCH CRITERIA AND THE ORDER ITS DISPLAYED ASC is > ASCENDING > $result = mysql_query ("SELECT * FROM example WHERE artists LIKE '$artists%' > AND aside LIKE '$aside%' AND bside LIKE '$bside%' AND label LIKE '$label%' > AND number LIKE '$number%' ORDER BY artists ASC"); > > if ($row = mysql_fetch_array($result)) { > > do { > > > file://THIS BLOCK DEFINES THE ALTERNATE ROW COLOURS > $darkcolor="#EEEEEE"; > $lightcolor="#FFFFFF"; > $test=$colorcount%2; > if ($test==0){ > $rowcolor=$darkcolor;} > else{ > $rowcolor=$lightcolor;} > $colorcount++; > > file://THIS BLOCK PUTS THE SEARCH RESULTS IN THE TABLE > echo("<tr valign=top bgcolor=$rowcolor></TD><TD><font size=1 face=Arial>" . > $row["artists"] . "</TD><TD><font size=1 face=Arial>" . $row["aside"] . > "</TD><TD><font size=1 face=Arial>" . $row["bside"] . "</TD><TD><font size=1 > face=Arial>" . $row["label"] . "</TD><TD><font size=1 face=Arial>" . > $row["number"] . "</TD><TD><font size=1 face=Arial>" . $row["price"] . > "</TD><TD><font size=1 face=Arial>" . $row["origin"] . "</TD><TD><font > size=1 face=Arial>" . $row["format"] . "</TD><TD><font size=1 face=Arial>" . > $row["info"] . "</TD></TR>"); > > } while($row = mysql_fetch_array($result)); > > } else {print "<font face=Arial>Sorry, no records were found!";} > > ?> > > </body> > </html> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]