This is a query that I have used successfully in a MySQL environment before. When I try it using MSSQL. It errors out on this statement:
$result = mssql_query("SELECT * FROM DriverAppInfo ORDER BY appdate LIMIT $startrow, 20")
$startrow is defined by the following:
if (!isset($_GET['startrow']) or !is_numeric($_GET['startrow'])) {
$startrow = 0;
}
else {
$startrow = (int)$_GET['startrow'];
}
Does $startrow in the query need to be surrounded by single quotes? Thank you in advance
1) check mssql_get_last_message()
2) show final SQL, use somethin like:
$sql = "SELECT * FROM DriverAppInfo ORDER BY appdate LIMIT $startrow, 20";
$result = mssql_query($sql);
echo $sql;
The limit
keyword translates to top
in MSSQL / Sql Server land.
You'll need to abstract that depending on MySQL / MSSQL. Remember:
PDO does not provide a database abstraction; it doesn't rewrite SQL or emulate missing features. You should use a full-blown abstraction layer if you need that facility.
Also I'll mention that with MSSQL depending on version limit, offset
might not be supported. Take a look at this for MSSQL pagination approaches.