I am having a very odd problem trying to encapsulate a library that isolates the underlying backend DB (I have to support both mssql and mysql with the same front end). I have isolated the offending code as follows:
$resb=sql_QUERY($sql); $recds=num_ROWS($resb); When the num_ROWS routine is called the following message is printed: Changed database context to 'test'. The number of rows returned is 0 (should be 1). The num_ROWS routine is: // // Return num of results // function num_ROWS($rs) { global $db_TYPE; switch($db_TYPE) { case 1: $r=mysql_num_rows($rs) or die(mysql_error()); return $r; case 2: return mssql_num_rows($rs) or die(mssql_get_last_message()); return $r; } } $db_TYPE contains "2" and the message is generated from the mssql_get_last_message routine. If I change the num_ROWS call to: $recds=mssql_num_rows($resb); it works without any problems. Another interesting thing is that if I run the following routine: <?php session_start(); include("common.php"); $db_TYPE=2; $conn=openDataConnection(); select_DB($EDB,$conn); $res=sql_QUERY("Select * from email where email_id='1234'"); $cnt=num_ROWS($res); print $cnt."<br>"; $r=fetch_ARRAY($res); print_r($r); closeConnection($conn); ?> The correct record is fetched and the num_ROWS routine returns the value 1 without a message (1 would also be the correct value for the production code also because I am using the same query and id number). I am running the same query against the same db/table using the same routines (db.php is included in common.php). In other words, it works the way it's supposed to. I was running 4.3.5 and upgraded to 4.3.6rc1 this morning and the problem still exists. If anyone could shed any light on this I would greatly appreciate it. Thanks, Michael -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php