Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 PHP error when change DB from MySQL to SQL200

Author  Topic 

haibec
Yak Posting Veteran

54 Posts

Posted - 2008-01-04 : 04:38:22
Please help me.
When i change DB from MySQL to SQL2000 . My Website (by PHP) code

<?
$rowsPerPage = 9; // how many rows to show per page
$pageNum = 1; // by default we show first page
$offset = ($pageNum - 1) * $rowsPerPage; // counting the offset
$sql = "SELECT id, name, logo FROM office WHERE accept=3 ORDER BY id DESC LIMIT $offset, $rowsPerPage";
$result = mssql_query($sql, $link);
for ($i=1;$i<=9;$i++)
{
if (($i%3) == 1)
echo "<tr>";
if ($row=mssql_fetch_array($result))
{
?>


When im runing appear error:

Warning: mssql_query() [function.mssql-query]: message: Line 1: Incorrect syntax near 'LIMIT'. (severity 15) in C:\AppServ\www\project\modules\category.php on line 66

Please help me solution for this error




harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-01-04 : 05:07:14
SQL Server does not support LIMIT clause. Closest possible match is TOP clause.

Also see this: http://weblogs.sqlteam.com/jeffs/archive/2003/12/22/672.aspx

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -