bind_param() only necessary on user-inputted values or all?

后端 未结 2 1201
无人共我
无人共我 2021-01-21 18:33

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         


        
2条回答
  •  执念已碎
    2021-01-21 19:26

    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'");
    

提交回复
热议问题