freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Adrian Saileanu" <adrian AT smartcall.ro>
- To: freetds AT lists.ibiblio.org
- Subject: [freetds] BUG when the query have no match ?
- Date: Fri, 25 Jul 2003 19:33:31 +0300 (EEST)
It seems that when no rows are returned by a query posted in PHP the
mssql_query is returning 1 and not a resource id ...
Ok, I created a table in my Sql Server 2000 ( SP 3.0 ) that's looking
like this :
a b c
1 2 two
2 3 tree
3 5 five
a int identity(1,1), b tinyint, c varchar(16)
and I have a php script looking like this :
$msdb = mssql_connect("192.193.194.1", "user", "pass");
mssql_select_db("database",$msdb);
$result = mssql_query("SELECT c FROM _test WHERE b = 2", $msdb);
echo("<br>$result : ");
while ( $msrow = mssql_fetch_row($result) )
echo($msrow[0]."<br>\n");
$result = mssql_query("SELECT c FROM _test WHERE b = 6", $msdb);
echo("<br>$result : ");
while ( $msrow = mssql_fetch_row($result) )
echo($msrow[0]."<br>\n");
$result = mssql_query("SELECT c FROM _test WHERE b = 3", $msdb);
echo("<br>$result : ");
while ( $msrow = mssql_fetch_row($result) )
echo($msrow[0]."<br>\n");
mssql_close($msdb);
The result is :
Resource id #3 : two
1 :
Warning: mssql_fetch_row(): supplied argument is not a valid Sybase result
resource in /home/www/anonim/index.php on line 12
Resource id #4 : tree
What am I doing wrong ?
Adrian Saileanu
Netmaster Communications Romania
address: Ion Mihalache 45, Bl. 16, Sc. B, Ap. 44, Sector 1, Bucuresti,
Romania
phone: +40 21 2234982
fax: +40 21 2232648
mobile: +40 788 374 703
email: adrian AT smartcall.ro
http: www.smartcall.ro
- [freetds] BUG when the query have no match ?, Adrian Saileanu, 07/25/2003
Archive powered by MHonArc 2.6.24.