<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 22 May 2013 05:46:56 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Brian Swan's Blog: Paging Data with the SQL Server Drivers for PHP: Simplified]]></title>
      <guid>http://www.phpdeveloper.org/news/15820</guid>
      <link>http://www.phpdeveloper.org/news/15820</link>
      <description><![CDATA[<p>
<i>Brian Swan</i> has <a href="http://blogs.msdn.com/b/brian_swan/archive/2011/01/26/paging-data-with-the-sql-server-drivers-for-php-simplified.aspx">simplified the pagination</a> 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.
</p>
<blockquote>
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.
</blockquote>
<p>
He shows how to execute a simple query with a dynamic cursor by specifying it in the connection call. He then uses the <a href="http://php.net/sqlsrv_num_rows">sqlsrv_num_rows</a> to find the number of records returned and a <a href="http://php.net/sqlsrv_fetch_array">sqlsrv_fetch_array</a> call to pull just the page you need. He also includes some handy code to paginate the results, complete with links.
</p>]]></description>
      <pubDate>Thu, 27 Jan 2011 12:54:56 -0600</pubDate>
    </item>
  </channel>
</rss>
