note 94711 added to pdostatement.bindparam

From: Date: Thu, 19 Nov 2009 19:28:54 +0000
Subject: note 94711 added to pdostatement.bindparam
Groups: php.notes 
Request: Send a blank email to php-notes+get-163100@lists.php.net to get a copy of this message
Note that when using PDOStatement::bindParam an integer is changed to a string value upon PDOStatement::execute(). (Tested with MySQL). This can cause problems when trying to compare values using the === operator. Example: <?php $active = 1; var_dump($active); $ps->bindParam(":active", $active, PDO::PARAM_INT); var_dump($active); $ps->execute(); var_dump($active); if ($active === 1) { // do something here // note: this will fail since $active is now "1" } ?> results in: int(1) int(1) string(1) "1" ---- Server IP: 208.69.120.35 Probable Submitter: 208.67.10.86 ---- Manual Page -- http://www.php.net/manual/en/pdostatement.bindparam.php Edit -- https://master.php.net/note/edit/94711 Del: integrated -- https://master.php.net/note/delete/94711/integrated Del: useless -- https://master.php.net/note/delete/94711/useless Del: bad code -- https://master.php.net/note/delete/94711/bad+code Del: spam -- https://master.php.net/note/delete/94711/spam Del: non-english -- https://master.php.net/note/delete/94711/non-english Del: in docs -- https://master.php.net/note/delete/94711/in+docs Del: other reasons-- https://master.php.net/note/delete/94711 Reject -- https://master.php.net/note/reject/94711 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#163100) next »