PHP PDO apostrophe

假如想象 提交于 2019-12-02 01:50:19

Essentially, you need to escape the string before using it within a query.

The best way to do this is through the use of PDO prepared statements:

$sqlSP="select record_created,record_updated from SP_IMPORT_CRM_SELECTIE (11, 'AC015612',:tester)";
$ps=$dbhandle->prepare($sqlSP);
$ps->bindParam(':tester',$tester,PDO::PARAM_STR);
$ps->execute();

(assuming that $dbhandle is your PDO object)

Try binding the parameters, take a look at the prepare method.

PHP.net PDO::Prepare

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