[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 [EMAIL PROTECTED] 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
Re: [PHP] mssql_prev_result()???
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); ? lt;lt; a href=index.php?i=?echo $i--;?PREVIOUS/a || a href=index.php?i=?echo $i++;?NEXT/a gt;gt; ? // ... print result from query here... ? -- Hope this helps, Kevin - Original Message - From: Joshua E Minnie [EMAIL PROTECTED] To: [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mssql_prev_result()???
MSSQL doesn't support LIMIT. You can use TOP, like SELECT TOP 10, * FROM users. I think that's the syntax. I don't know if there is a way to say return rows from 10 - 20 in MSSQL. ---John Holmes... - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: PHP-general [EMAIL PROTECTED]; Joshua E Minnie [EMAIL PROTECTED] Sent: Friday, May 03, 2002 12:54 PM Subject: Re: [PHP] mssql_prev_result()??? 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); ? lt;lt; a href=index.php?i=?echo $i--;?PREVIOUS/a || a href=index.php?i=?echo $i++;?NEXT/a gt;gt; ? // ... print result from query here... ? -- Hope this helps, Kevin - Original Message - From: Joshua E Minnie [EMAIL PROTECTED] To: [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php