Skip to content
Advertisement

SQLSRV skips a row when returning a query

JavaScript

The code above does what I want and returns number of rows that matches what the query returns.

However, I hardcoded the three sqlsrv_next_result($result);. The query will change depending on @AmbassadorID, so that piece needs to be dynamic. I tried the following loop:

JavaScript

But this loop skips the first row. How do I fix this?

Thanks!

Advertisement

Answer

Use sqlsrv_has_rows(). This just returns whether there are any rows, but it doesn’t fetch one of them.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement