MDB2 placeholder shorthand with DB->query
Question
I just realized that the pear:DB extension is deprecated and I'm working on updating some scripts to MDB2. I'm a little disappointed how cumbersome the placeholder arrangement is. Am I missing something? Is there a shorthand available that is equivalent to the pear:DB construct:
$result = $db->query("SELECT * FROM table WHERE column1 = ? AND column2 = ?", array($column1, $column2);
As far as I can tell, achieving the same result (no pun intended) would require several lines and a call to MDB2-prepare(), MDB2->execute() etc....
Is any shorthand construct available for MDB2?
Solution
No, there is none. You have to use prepare()
+ execute()
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow