Welcome Guest, Not a member yet? Register   Sign In
Database classes for SQL Server 2005 and SQL Server 2008 (using php_sqlsrv.dll from the Microsoft Data Programmability t
#39

[eluser]greenflash[/eluser]
[quote author="ballmatic" date="1326914705"]I just got handed a project using PHP/CodeIgniter and SQL Server 2008 R2. I've downloaded and installed the Microsoft PHP+SQL 2.0 drivers and these unofficial drivers. I copied some of the code in here to fix some of the issues. But I'm having a problem with the offset options when paging.

Code:
$this->db->limit(10, 5);
$query = $this->db->get('table_name');

shorthand version doesn't work either:

Code:
$query = $this->db->get('jobs', 5, 10);

Doesn't give me the results back that I'm looking for. Am I doing something wrong?
[/quote]

Been myself in the same battle. Problem seems to be really SQL Server that doesn't support any LIMIT/OFFSET variant. Currently (prototyping only), I'm using ADODB adapted for codeigniter for SQLServer2008 and some tweaks in CI paginator; the trick I guess is that ADODB has some internal workaround for SQLServer to "skip" records in a cache in order to mimic the OFFSET utility, CI ActiveRecord is more pure. SQLServer 2012 will finally have something for this functionality to work natively (only will work on WinServer 2008+/Win7)

Code:
SELECT email FROM emailTable WHERE id=3
OFFSET 10 ROWS
FETCH NEXT 10 ROWS ONLY;


Messages In This Thread
Database classes for SQL Server 2005 and SQL Server 2008 (using php_sqlsrv.dll from the Microsoft Data Programmability t - by El Forum - 03-28-2012, 05:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB