What does bind_param() do?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 03:55:17

问题


$resultSpendStmt = $connection->prepare(...);
$array->bind_param("sdidi", $A, $B, $C, $D, $E);
$array->execute();
$array->store_result();
$array->bind_result($F, $G, $H, $I, $J, $K);

I am still a little unsure what bind_param does. Can someone give me an example as to what is means?


回答1:


When you prepare an SQL statement, you can insert a placeholder (?) where a column value would go, then use bind_param() to safely substitute that placeholder for the real column's value. This prevents any possibility of an SQL injection.

You can read more about bind_param() here.



来源:https://stackoverflow.com/questions/10874644/what-does-bind-param-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!