Nested queries don't work
| From: | Rich Fox | Date: | Wed, 15 Oct 2003 19:36:52 +0000 |
| Subject: | Nested queries don't work | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-166240@lists.php.net to get a copy of this message | ||
I have the following code querying MS SQL Server
$query = "SELECT * FROM mytable";
$res = mssql_query($query);
$nr = mssql_num_rows($res);
for ($i=0; $i<$nr; $i++)
{
$a = mssql_fetch_array($res);
$query = "SELECT * FROM anothertable WHERE id=".$a['anotherID'];
$res1 = mssql_query($query);
$anr = mssql_num_rows($res1);
...
}
This does NOT work! It seems that the 2nd query steps on the results of the
first one! Can someone verify this effect? I am 99.999% sure this is what's
happening. Who is the bonehead responsible for not implementing this for MS
SQL Server?
Thanks
Rich