Re: Displaying one record per page
| From: | Bobo Wieland | Date: | Thu, 28 Aug 2003 07:42:24 +0000 |
| Subject: | Re: Displaying one record per page | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-21267@lists.php.net to get a copy of this message | ||
If I understood you correct you could do something like this with mysql:
<code>
$recnum = (isset($_GET["recnum"])) ? $_GET["recnum"] : 1;
$q = "SELECT * FROM table LIMIT ".$recnum.",1";
$r = mysql_query($q, $link_id);
$row = mysql_fetch_object($r);
print ($row->some_field);
print ("<a
href='thispage.php?recnum=".max($recnum-1,1)."'>PREV</a>");
print ("<a
href='thispage.php?recnum=".($recnum+1)."'>NEXT</a>");
mysql_free_result($r);
</code>
.bobo dev@elstudion.com
----- Original Message -----
From: "Harpreet" <harpreet@crispincorp.com>
To: "Croskerry, Dan" <dcrosker@hpl.ca>; <php-windows@lists.php.net>
Sent: Thursday, August 28, 2003 5:38 AM
Subject: Re: [PHP-WIN] Displaying one record per page
> MSSQL and MYSQL both. I need a solution for both as the web app is going
to
> run on b oth databases.
>
> ----- Original Message -----
> From: "Croskerry, Dan" <dcrosker@hpl.ca>
> To: <php-windows@lists.php.net>
> Sent: Wednesday, August 27, 2003 4:16 PM
> Subject: RE: [PHP-WIN] Displaying one record per page
>
>
> > What database are you using? MySQL, MSSQL, Oracle...?
> >
> > -----Original Message-----
> > From: Harpreet [mailto:harpreet@crispincorp.com]
> > Sent: Wednesday, August 27, 2003 2:33 PM
> > To: php-windows@lists.php.net
> > Subject: [PHP-WIN] Displaying one record per page
> >
> >
> > I have a sql command that returns more then one rows. I want to display
> one
> > record per page using NEXT to show the other records. Each page
displaying
> > one record.
> >
> > Help is appreciated.
> >
> > Regards,
> > Harpreet Kaur
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>