note 95327 added to pdostatement.bindvalue

From: Date: Sun, 27 Dec 2009 18:43:03 +0000
Subject: note 95327 added to pdostatement.bindvalue
Groups: php.notes 
Request: Send a blank email to php-notes+get-164354@lists.php.net to get a copy of this message
bindValue with data_type depend parameter name <?php $db = new PDO (...); $db -> setAttribute (PDO::ATTR_STATEMENT_CLASS, array ('MY_PDOStatement ', array ($db))); class MY_PDOStatement extends PDOStatement { public function execute ($input = array ()) { foreach ($input as $param => $value) { if (preg_match ('/_id$/', $param)) $this -> bindValue ($param, $value, PDO::PARAM_INT); else $this -> bindValue ($param, $value, PDO::PARAM_STR); } return parent::execute (); } } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 94.75.74.26 ---- Manual Page -- http://www.php.net/manual/en/pdostatement.bindvalue.php Edit -- https://master.php.net/note/edit/95327 Del: integrated -- https://master.php.net/note/delete/95327/integrated Del: useless -- https://master.php.net/note/delete/95327/useless Del: bad code -- https://master.php.net/note/delete/95327/bad+code Del: spam -- https://master.php.net/note/delete/95327/spam Del: non-english -- https://master.php.net/note/delete/95327/non-english Del: in docs -- https://master.php.net/note/delete/95327/in+docs Del: other reasons-- https://master.php.net/note/delete/95327 Reject -- https://master.php.net/note/reject/95327 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164354) next »