PHP 4.0 Bug #4455: ifx_affected_rows() & ifx_num_rows() don't return correct numbers of rows.

From: Date: Mon, 15 May 2000 16:29:52 +0000
Subject: PHP 4.0 Bug #4455: ifx_affected_rows() & ifx_num_rows() don't return correct numbers of rows.
Groups: php.dev 
Request: Send a blank email to php-dev+get-18771@lists.php.net to get a copy of this message
From: jfuertes@maz.es 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@mazesc2_tcp", "*****", "*****"); # 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.

« previous php.dev (#18771) next »