RE: [PHP] Re: next and previous links
| From: | Boaz Yahav | Date: | Sun, 07 Oct 2001 12:47:42 +0000 |
| Subject: | RE: [PHP] Re: next and previous links | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-70284@lists.php.net to get a copy of this message | ||
http://www.weberdev.com has many examples and ready code for
you on this
issue.
Sincerely
berber
Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.
-----Original Message-----
From: Richard Lynch [mailto:ceo@l-i-e.com]
Sent: Friday, October 05, 2001 10:05 PM
To: Mick Fitzpatrick
Cc: php-general@lists.php.net
Subject: [PHP] Re: next and previous links
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 richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
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 <mick@night-owl.co.uk>
Newsgroups: php.general
To: <php-general@lists.php.net>
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: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net