0

This is a follow-up question from previous post: PHP SQL Server Alternative for TOP and LIMIT of MYSQL

TOP is the equivalent of LIMIT in sql server: http://www.w3schools.com/sql/sql_top.asp

It does work somehow when I type in:

 $construct1 ="SELECT TOP $per_page * FROM ENSEMBLE WHERE $construct";

but when I add $start:

 $construct1 ="SELECT TOP $start, $per_page * FROM ENSEMBLE WHERE $construct";

It gives me an error message saying..

Warning: sqlsrv_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\trueensemble\search1.php on line 51

I decided running error reporting after that to get a detailed error and I got:

[SQL Server]Incorrect syntax near ','. )

I tried removing comma, now gives me an error message:

[SQL Server]Incorrect syntax near the keyword 'FROM'. )

I saw this post: Equivalent of LIMIT and OFFSET for SQL Server?, but I have no idea how can I rewrite it using the code I used in mysql..

Community
  • 1
  • 1
user3596261
  • 19
  • 1
  • 8

0 Answers0