0

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

0

2 Answers 2

1

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.

0

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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.