开发者

MDB2 placeholder shorthand with DB->query

开发者 https://www.devze.com 2023-03-06 03:46 出处:网络
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 somet

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 fa开发者_JAVA百科r 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?


No, there is none. You have to use prepare() + execute().

0

精彩评论

暂无评论...
验证码 换一张
取 消