News for hackers. Stuff that matters.
[deleted]
Re:A guide to preventing SQL injection by brazzy on Tuesday September 15, 2009 @12:01PM (#824086)
That's exactly what the page says NOT to do - attempt to escape input data. Instead, use MySQLi_STMT http://de2.php.net/manual/en/class.mysqli-stmt.php
Re:A guide to preventing SQL injection by mustaphamond on Tuesday September 15, 2009 @11:57AM (#824077)
also, if you're using PDO:

$stmt = $dbh->prepare( 'SELECT foo, bar from fooBar where foo = :fooValue' ); $stmt->bind( ':fooValue', $foo ); $stmt->execute();

Re:A guide to preventing SQL injection by randallsquared on Tuesday September 15, 2009 @02:36PM (#824445)
If you're using PDO, it's usually going to be easier to do:

    $stmt = $dbh->prepare( 'SELECT foo, bar from fooBar where foo = ?' );
    $stmt->execute($foo);
The only case where using named parameters is really useful is when there are so many parameters you're reduced to counting question marks.