note 78173 added to function.PDOStatement-bindParam
| From: | JJRock at osu1 dot php dot net | Date: | Mon, 01 Oct 2007 22:37:57 +0000 |
| Subject: | note 78173 added to function.PDOStatement-bindParam | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130971@lists.php.net to get a copy of this message | ||
Does anybody see anything wrong with using bindParam this way? BTW, it does work...
// $query is our parameterized query
// $params is an array of :param => value
public function getResultWithParameters($query,$params) {
$statement = $db->prepare($query);
foreach ($params as $key=>$value) {
$statement->bindParam($key,$value);
}
$statement->execute();
}
I'm calling this class function from outside the class, so I just want to send the
parameterized query and the parameters and let the function do the binding.
I realize I lose some functionality, like being able to call the execute() method multiple time with
different parameters just by changing the variables. Anybody have insight as to why I would not
want to use this?
----
Server IP: 69.147.83.197
Probable Submitter: 63.111.113.123
----
Manual Page -- http://www.php.net/manual/en/function.PDOStatement-bindParam.php
Edit -- https://master.php.net/note/edit/78173
Del: integrated -- https://master.php.net/note/delete/78173/integrated
Del: useless -- https://master.php.net/note/delete/78173/useless
Del: bad code -- https://master.php.net/note/delete/78173/bad+code
Del: spam -- https://master.php.net/note/delete/78173/spam
Del: non-english -- https://master.php.net/note/delete/78173/non-english
Del: in docs -- https://master.php.net/note/delete/78173/in+docs
Del: other reasons-- https://master.php.net/note/delete/78173
Reject -- https://master.php.net/note/reject/78173
Search -- https://master.php.net/manage/user-notes.php