Hi All,
I am working on a PHP/SQL query and I am getting the correct number of records from the table and the correct data, but my loop does not seem to finish; note the
echo '<br /><br />end the 1st loop';
after the loop, it does not echo.
echo '------------Starting 1st loop--------------------<br /><br />';
$msconnect=mssql_connect("x","x","x") or die("Could not connect to the database.");
$msdb=mssql_select_db("x",$msconnect) or die("Could not select the database.");
//1st loop
$query = mssql_query("SELECT * FROM AMGR_Client_Tbl WHERE Record_Type='42'") or exit(mysql_error());
echo '<pre>';
print_r($query).'<br>';
echo '</pre>';
$total_rows = mssql_num_rows($query);
echo 'The total number of records is '.$total_rows.'<br /><br />';
$x=1;
while ($row = mssql_fetch_array($query) or die (mysql_error())) {
echo $x.') '.$row['First_Name'].' '.$row['Name'].'<br />';
$x++;
}
echo '<br /><br />end the 1st loop';
I am expecting 2 records and I get ...
------------Starting 1st loop--------------------
Resource id #3
The total number of records is 2
1) record 1
2) record 2
But no '<br /><br />end the 1st loop'???
Am I missing something obvious here or is it something in the SQL stored procedure that is the issue?
Thanks in advance,
Don