note 13569 added to ref.mysql.php

From: Date: Fri, 22 Jun 2001 01:11:48 +0000
Subject: note 13569 added to ref.mysql.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-14547@lists.php.net to get a copy of this message
The mysql_fetch_[row|object|array] functions return data as type string. Owing to the very flexible nature of php variables, this is normally not relevent, but if you happen to retrieve two integers from a database, then try to compare with bitwise operators, you'll run into trouble, because (19 & 2) == 2, but ("19" & "2") == 0. To remedy this, if you use variables from a database with bitwise operators, use the settype() function to explicitly cast your variables as integers before comparing. http://www.php.net/manual/en/ref.mysql.php

« previous php.notes (#14547) next »