[PHP-DEV] PHP 4.0 Bug #4455: ifx_affected_rows() & ifx_num_rows() don't return correct numbers of rows. From: jfuertes <email protected>
Date: 05/15/00

From: jfuertes <email protected>
Operating system: Red Hat Linux 6.1
PHP version: 4.0 Release Candidate 2
PHP Bug Type: Misbehaving function
Bug description: ifx_affected_rows() & ifx_num_rows() don't return correct numbers of rows.

ifx_affected_rows() allways returns 1 even if a query result is empty.
ifx_num_rows() allways returns 0 even if a query result got rows.

Code:

<?PHP
   #----------------------------------------------------------------------
   #----------------------------------------------------------------------

   # DB Connection:
   $conid = ifx_connect("incidencias <email protected>", "*****", "*****");

   # Checks for error:
   if (!$conid) {
      echo "ERROR connecting DB:<hr>";
      printf("Error: %s", ifx_error()); echo "<HR>";
      die;
   } else {

   # Query:
                $stquery = ifx_prepare("SELECT * FROM usuarios WHERE login = '$login'", $conid, IFX_SCROLL);
                ifx_do($stquery);

      # Checks for error:
      if (!$stquery) {
         printf( "Error: %s<br>", ifx_error() );
         echo "$stquery<br>";
         ifx_close($conid);
         die;

      # Checks number of rows:
      } else {
         $nrows = ifx_affected_rows($stquery); #Or ifx_num_rows()
         echo $nrows;
         echo "<br>";
         if ($nrows < 1) {
                        echo "User $login not found.";
                                ifx_htmltbl_result($stquery, "border=\"1\""); ### ifx_affected_rows() allways goes here.
                        ifx_close($conid);
                        die;
         }
         echo "User OK.<br>"; ### ifx_num_rows allways goes here.

Tankyou very much.

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>