tags:

views:

555

answers:

2
+1  Q: 

limit in php PDO?

Hi,

as people suggested me, I started using PDO library instead of Creole.

Most of things are almost same as Creole, but I cannot find a function to set limit.

I do not think that I should include limit statement in my query string since mssql and mysql do not share same syntax.

please advise me.

+2  A: 

From the PHP Manual http://www.php.net/manual/en/ref.pdo-mysql.php

PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data. PDO does not provide a database abstraction; it doesn't rewrite SQL or emulate missing features.

Since it doesn´t rewrites SQL statements, you´ll not find a method to do generic pagination.

Renato Aquino
A: 

To go along with what Renato said, You should be aware that only function calls are the same to run your SQL statements, and that whatever SQL you send to the server is completely unmodified. Coding SQL for multiple databases can be quite tricky. Especially if you want to branch away from simple SQL statements into more complex things like stored procedures. Even basic things like function calls (IsNull vs. IfNull) can make make your task much harder than it needs to be.

Kibbee