RE: I need do paging in php, I use ODBC Access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux