I\'ve been reading up on SQL injections and I couldn\'t find an answer to this question.
I understand if I a query like this
prepare(\"SELECT id, foo, ba
If you are not running your query on user-inputed values, then use the query() method instead. Don't use bindParams() and execute() since you are not working with prepare().
query(SELECT username, foo, bar from table where id = '$id'");
Technically you're not at risk if you don't prepare data that's not coming from user input. However, it's strongly advised to do so for a couple of reasons:
Somewhere in your code you have a log system that adds an errorlog to your database. The string would be:
Error: User "xxx" with IP "x.x.x.x" used a wrong password.
This string is generated by your script. Therefor you don't prepare it. Yet the quotes inside this string will cause errors with your database that could've been prevented if you prepared it anyway.