note 54518 rejected from function.ifx-num-rows by betz

From: Date: Thu, 07 Jul 2005 09:16:13 +0000
Subject: note 54518 rejected from function.ifx-num-rows by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-91579@lists.php.net to get a copy of this message
Note Submitter: sjacoil at saljournal dot com ---- Indeed, ifx_num_rows always returns zero, but likewise, ifx_affected_rows never returns zero (it is always one or greater), even when it should be zero. This creates a problem if one wants to do authentication using a query such as "select * from users where username = $username and password = $password". When using something like: function login($username, $password){ $sql = "select * from users where username = $username and password = $password"; $result = ifx_query($sql, $conn); if(!$result) return 0; if(ifx_affected_rows($result)>0) return 1; else return 0; } Using ifx_num_rows, authentication always fails. When using the same with ifx_affected_rows, authentication is always successful, regardless of a wrong login. Is this a bug, or am I doing something wrong?

« previous php.notes (#91579) next »