RE: [PHP-DEV] pdo: binding variables supplied to execute() is NotVeryUseful(tm)...
| From: | Jared Williams | Date: | Fri, 25 Mar 2005 16:40:20 +0000 |
| Subject: | RE: [PHP-DEV] pdo: binding variables supplied to execute() is NotVeryUseful(tm)... | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-15605@lists.php.net to get a copy of this message | ||
> jared, i fail to understand your "contribution" to the real
> subject ("do we need a colon in from of every bound variable or not").
I was pointing out your design was flawed. Which if was made more secure, like the following, the
colons become less of an issue.
$db->insert('some_table', array(':name' => $name, ':age' =>
$age));
class ...
{
protected $tableInserts = array(
'some_table' => 'INSERT INTO some_table VALUES(:name, :age)'
);
function insert($table, $values)
{
if (isset($this->tableInserts[$table]))
{
$stmt = $this->prepareStatement($this->tableInserts[$table]);
$stmt->execute($values);
}
else
{
... Error...
}
}
}