Re: mssql_prev_result()???
| From: | Kevin Stone | Date: | Fri, 03 May 2002 16:54:23 +0000 |
| Subject: | Re: mssql_prev_result()??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95926@lists.php.net to get a copy of this message | ||
You can navigate through records with Next and Previous buttons by using
LIMIT in your query statment.
----------------------------------------------------
<? // index.php
if (!isset($i))$i=0;
// Retrieve 1 rows starting at row $i
$query = "SELECT * FROM mytable LIMIT $i,1";
$result = mysql_query($query, $db);
?>
<<
<a href="index.php?i=<?echo $i--;?>">PREVIOUS</a>
||
<a href="index.php?i=<?echo $i++;?>">NEXT</a>
>>
<?
// ... print result from query here...
?>
------------------------------------------------------
Hope this helps,
Kevin
----- Original Message -----
From: "Joshua E Minnie" <josh@acsurf.net>
To: <php-general@lists.php.net>
Sent: Friday, May 03, 2002 10:35 AM
Subject: [PHP] mssql_prev_result()???
> Does anybody know of a good way to get the previous result in a query
> result?
>
> The query looks like this: SELECT * FROM [users]. This will return a
result
> set of 30 to 40 users.
>
> The reason I need to grab the previous is because I would like to be able
to
> "virtually" scroll through my data in the table. Here is some psuedocode
of
> what I am trying to do:
>
> <the form>
> //fields to be filled by the user data that comes in from each query
> <button value=previous user onClick=get_prev_user()>
> <button value=next user onClick=get_next_user()>
> </the form>
>
>
> --
> Joshua E Minnie/CIO
> josh@acsurf.net
> Phone: 616.276.9690
> Fax: 616.342.8750
> Nextel: 616.862.2847
>
> "Don't work for recognition, but always do work worthy of recognition." ~
> Unknown
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>