I code for a living. Well, that's my technical job title. Really, I'm one of those "DevOps" guys.
I did not write the questions or answers below. They're an unfortunate necessity considering the number of SQL-injection-vulnerable scripts and deprecated function usage I see on here every day. This is just the easy way for me to keep track of the links to give to others. =)
How can I prevent SQL injection in PHP?
Why shouldn't I use mysql_* functions in PHP?