note 97881 added to mongo.queries
| From: | CharleDemers at osu1 dot php dot net | Date: | Thu, 13 May 2010 16:14:24 +0000 |
| Subject: | note 97881 added to mongo.queries | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169220@lists.php.net to get a copy of this message | ||
Watch for types casting in your queries, make sure ints are typed as ints and strings as strings.
Ex:
<?php
$friendId = $_SESSION['friendId'];
$request = array( 'friends.friendId' => (int)$friendId );
$friend = $this->_mongo->friends->findOne( $request );
?>
This example would not work without casting the $friendId to int in the request array (unless the
friendId column in Mongo is actually really a string).
----
Server IP: 69.147.83.197
Probable Submitter: 66.130.8.198
----
Manual Page -- http://www.php.net/manual/en/mongo.queries.php
Edit -- https://master.php.net/note/edit/97881
Del: integrated -- https://master.php.net/note/delete/97881/integrated
Del: useless -- https://master.php.net/note/delete/97881/useless
Del: bad code -- https://master.php.net/note/delete/97881/bad+code
Del: spam -- https://master.php.net/note/delete/97881/spam
Del: non-english -- https://master.php.net/note/delete/97881/non-english
Del: in docs -- https://master.php.net/note/delete/97881/in+docs
Del: other reasons-- https://master.php.net/note/delete/97881
Reject -- https://master.php.net/note/reject/97881
Search -- https://master.php.net/manage/user-notes.php