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

From: Date: Tue, 16 May 2000 05:53:04 +0000
Subject: PHP 4.0 Bug #4455 Updated: 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-18825@lists.php.net to get a copy of this message
ID: 4455 User Update by: jfuertes@maz.es Old-Status: Open Status: Closed Bug Type: Misbehaving function Description: ifx_affected_rows() & ifx_num_rows() don't return correct numbers of rows. This is not a bug. -------------------- > ifx_affected_rows() allways returns 1 even if a query result is empty. Because no rows are AFFECTED, and cannot be, with select. See Informix manual for SQLCA record, and ifx_getsqlca() function. > ifx_num_rows() allways returns 0 even if a query result got rows. This function is often misunderstood, probably because it have name similar to num_rows function in other PHP db interfaces that DO return actual number of returned rows. In short, returned number is SQL's engine optimizer's guess about the number of rows to be returned. See same as above. ....snip.... If you are really interested in number of rows returned, you will need to do SELECT COUNT(*) again with same where-part, or fetch row-by-row and count them. If you just want to see if row exists, do something like $res_id = ifx_query($sql, $connid); $row = ifx_fetch_row ($res_id, "FIRST"); if ( $row == FALSE) {$NOTFOUND=true;}else{$NOTFOUND=false;} Yes, we probably need REAL ifx_num_rows() function. This is not a bug. It may be a feature request. Should be closed. Yours, Andrej Falout, http://www.falout.com ICQ 7628616 Full Bug description available at: http://bugs.php.net/version4/?id=4455

« previous php.dev (#18825) next »