note 54518 added to function.ifx-num-rows
| From: | sjacoil at saljournal dot com | Date: | Wed, 06 Jul 2005 21:23:08 +0000 |
| Subject: | note 54518 added to function.ifx-num-rows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91554@lists.php.net to get a copy of this message | ||
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?
----
Manual Page -- http://www.php.net/manual/en/function.ifx-num-rows.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54518
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54518&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54518&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54518&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54518&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54518&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54518&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54518&report=yes
Search -- http://master.php.net/manage/user-notes.php