I am trying to connect two tables together with INNER JOIN and limit the amount of results displayed per page with ROW_NUMBER:\[code\]$tsql = "SELECT *FROM (SELECT ROW_NUMBER() OVER(ORDER BY productID) ASrownum, * FROM products INNER JOIN product_catalogue ON products.catalogueID = product_catalogue.catalogueID WHERE category1 = '1') AS products1WHERE rownum >= 0 AND rownum <= 6"; $stmt = sqlsrv_query($conn,$tsql); while($row = sqlsrv_fetch_array($stmt)){ echo $row['productID']. "<br/>"; echo $row['product_name']. "<br/>"; }\[/code\]I get "sqlsrv_fetch_array() expects parameter 1 to be resource" error , and I know it has something to do with me using INNER JOIN, because if I run the query without it I get results displayed on my page:\[code\]$tsql = "SELECT *FROM (SELECT ROW_NUMBER() OVER(ORDER BY productID) ASrownum, * FROM products ) AS products1WHERE rownum >= 0 AND rownum <= 6";\[/code\]