Re:PHP to deprecate MySQL extension
by masklinn on Friday July 15, 2011 @11:38AM
(#2767763)
> If you go the resilient route with everything you end up with code that looks like Java code.
Meh. Prepared statements are useful when you'll use the it multiple times through rebinding, and for one-shots it's easy enough to have a function taking a parameterized query and an array and doing the annoying crap internally.
Re:PHP to deprecate MySQL extension
by eropple on Friday July 15, 2011 @11:45AM
(#2767804)
This is actually fairly close to what I do in my own code (I actually extend the PDO object, but same idea). The example I gave was just using the base PDO library instead.
Meh. Prepared statements are useful when you'll use the it multiple times through rebinding, and for one-shots it's easy enough to have a function taking a parameterized query and an array and doing the annoying crap internally.
Then you just write: