its also been a while since I've done web dev.
its also been a while since I've done web dev.
In no small part because novice developers also have a tendency to build queries directly out of $_GET parameters.
While PDO and parameterized queries aren't a silver bullet, simple strings as queries are just a nightmare to do properly.[2]
[1] http://stackoverflow.com/questions/60174/how-to-prevent-sql-... [2] http://www.youtube.com/watch?v=o4dJ7hdA8fs
All you need to do is use a database layer with placeholder values and if you're diligent about encoding everything that way, your chances of being hacked by a simple SQL injection bug are nearly zero. You'll have to make several mistakes before you're in hot water.
`mysql_query` is the worst possible interface to MySQL since it's literally the low-level C bindings ported in to PHP without any kind of enhancement. Those functions were intended for writing more abstract interfaces, not being used directly.
While it is possible to write mysql_query code correctly, it is very challenging and not worth the time when facilities like PDO exist.
Also, if you loathe "over abstracted" database libraries you're probably using the wrong library. A library should make your database interfacing easier, not harder.