4 ms·
The Easy Way to Prevent SQL Injection in PHP Applications
- Xeoncross 11y agoI wrote a prepared-statement only PDO database abstraction for PostgreSQL, SQLite, and MySQL in 1kb for PHP called https://github.com/Xeoncross/DByte https://github.com/Xeoncross/DByte. Sure it's bad form for not supporting dependency injection - but at 1kB it's mostly there to show new programmers how easy it is to use PDO calls correctly to get the results you want. Rather than wasting time iterating over the column results (https://github.com/paragonie/easydb/blob/master/src%2FEasyDB.php#L25-L43 https://github.com/paragonie/easydb/blob/master/src%2FEasyDB...), you can just tell PDO to return that column (https://github.com/Xeoncross/DByte/blob/master/DByte/DB.php#L73-L81 https://github.com/Xeoncross/DByte/blob/master/DByte/DB.php#...).
- paragon_init 11y agoThanks for pointing this out. We're always looking for ways to improve our open source projects and will make the necessary improvements. EDIT: Done. :)