News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Brian Swan's Blog:
Paging Data with the SQL Server Drivers for PHP Simplified
January 27, 2011 @ 12:54:56

Brian Swan has simplified the pagination using the SQL Server drivers for PHP in his latest post. He shows how to use a cursor to move around in the result set from your query.

An oversimplified definition of a database cursor might be this: A cursor is database functionality that allows you to point to a certain location within a result set and allows you to move forward (and sometimes backward, depending upon the cursor type) through the result set one row at a time. [...] In the paging [scenario], I'll use a static cursor since that cursor type would seem to satisfy the requirements of many web-based applications.

He shows how to execute a simple query with a dynamic cursor by specifying it in the connection call. He then uses the sqlsrv_num_rows to find the number of records returned and a sqlsrv_fetch_array call to pull just the page you need. He also includes some handy code to paginate the results, complete with links.

0 comments voice your opinion now!
sqlserver driver pagination numrows tutorial cursor


blog comments powered by Disqus

Similar Posts

Matthew Weier O'Phinney's Blog: Using the ZF2 EventManager

NETTUTS.com: Building a 5 Star Rating System with jQuery, AJAX and PHP

TechChorus Blog: Create RESTful Applications Using The Zend Framework

Christoph Dorn's Blog: FirePHP and Zend Framework 1.6

PHPMaster.com: Data Structures for PHP Devs: Heaps


Community Events











Don't see your event here?
Let us know!


database release introduction package symfony2 application podcast series opinion component performance facebook hhvm language hack framework security install composer unittest

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework