Hello people, I have raised this issue before in this forum and now I wish to visit it again since it has been a consistent problem. I'll explain this problem using an example. Here is the example code.
$sqlquery=mssql_init("Gssp_GetUserRoles",$sqlconnect);
mssql_bind($sqlquery,"@username",&$username,SQLVARCHAR);
$result=mssql_execute($sqlquery);
$numrows=mssql_num_rows($result);
In search a case, assuming the number of records in the database is five, the row count returns the actual number, therefore in this case when you echo $numrows it displays five (5) which is the correct figure. But when you echo the results, the records shown are one less the actual records, in this case four records are displayed instead of five. here is the code for displaying the results
if(mssql_fetch_array($result))
{
do
{
for ($i=0; $i<=$numrows; $i++)
{
while($row=mssql_fetch_array($result))
{
$_SESSION[i]=($row['name']);
echo $_SESSION[i];
}
}
} while(mssql_next_result($result));
}
I have realised that it's the first record that is skipped. Has anyone encountered a similar problem and what's the solution ?
Thank you all in advance. I'm using SQL 2000