Re: I need do paging in php, I use ODBC Access
| From: | chris | Date: | Thu, 21 Apr 2005 21:02:17 +0000 |
| Subject: | Re: I need do paging in php, I use ODBC Access | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-213608@lists.php.net to get a copy of this message | ||
You are right about MSSQL not having a limit, but here is an article that
shows a work around....
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=850&lngWId=5
"Warren Vail" <warren@vailtech.net> wrote in message
news:04e901c546a7$a465b9a0$6401a8c0@NICKER...
>> Somebody did paging in php for data origin in ODBC Access?
>>
>> I need an algorithm for doing this, please Help me!!!!!
>
> I assume by "paging" you are referring to a scrolling algorithm that
> allows you to view only a small portion of your query result set. The
> algorithm that comes to mind is dependent on the database that ODBC is
> connected to.
>
> If the database is MySQL, the query that would allow do this is the SQL
> LIMIT clause, where executing and re-executing the query will return
> only a portion of the sequence set produced by the query;
>
> $query = "SELECT ".$columnlist
> ." from my_table where col1 = \"sold\" order by order_date "
> ."LIMIT ".sprintf("%01d",$rowno).", 10 ";
>
> If $rowno = 0 the query will return the first 10 rows
> If you add 10 to $rowno and re-execute the query, it will return the
> second set of 10 rows
> And so on.
>
> I have used ODBC to access Microsoft SQL Server and DB2 Databases, and I
> believe neither support the SQL LIMIT clause, although I am not as
> certain about my memory of MSS as DB2. Someone will correct me if I am
> wrong.
>
> The only approach left that I could come up with is to transfer the
> entire sequence set to your application, and count the rows, perhaps
> only displaying the rows you want to show. This is obviously not very
> efficient (in fact, with enough rows it may prove impossible because of
> memory limitations), but it will produce what appears to be a paged
> result.
>
> HTH,
>
> Warren Vail