News for hackers. Stuff that matters.
Re:PHP to deprecate MySQL extension by Groxx on Friday July 15, 2011 @11:34AM (#2767745)
If you go the resilient route with everything you end up with code that looks like Java code. It's not usually worth it, as when the query changes, odds are you'll be looking at the parameters, and will notice changes. Not true for large queries, of course, but for beginners? They're writing things like the above, where the entire process fits in a single eyefull. Making it more verbose from the get-go means they're more likely to just concatenate strings.
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.

Then you just write:

    $result = executeSQL($somePDOObject,
        "INSERT INTO folks (name, addr, city) values (:name, :addr, :city);",
        array("name" => $name, "addr" => $addr, "city" => $city);
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.