问题
它用双引号替换单引号
回声 $movement_data
输出字符串:
'200407', '200396', '200397', '200398', '200399', '200400', '200401', '200402', '200403', '200404'
推进代码:
$c->add(VmemberDetailsPeer::PERSON_ID,array(htmlentities($movement_data, ENT_QUOTES)),Criteria::IN);
echo $c->toString();
$person = VmemberDetailsPeer::doSelect($c);
推进查询
Criteria: SQL (may not be complete): SELECT FROM vmember_details WHERE vmember_details.PERSON_ID IN (:p1) Params: vmember_details.PERSON_ID => ''200407', '200396', '200397', '200398', '200399', '200400', '200401', '200402', '200403', '200404''
输出:
array(0) { }
我需要的
我需要在 where 子句中传递相同的逗号分隔字符串。
如果我直接在数组($movement_data)中推送motion_data comm 分隔字符串
- 它输出特殊字符,如'\2222\',等等......我在 where 子句中有 htmlspecial 字符。
不要使用 Htmlentities 结果推动查询
SELECT FROM vmember_details
WHERE vmember_details.PERSON_ID IN (:p1)
Params: vmember_details.PERSON_ID => '\'200407\', \'200396\', \'200397\', \'200398\', \'200399\', \'200400\', \'200401\', \'200402\', \'200403\', \'200404\''
我尝试使用explode make string to array的解决方案:
$x=explode(",",$movement_data);
输出:
Array
(
[0] => '200407'
[1] => '200396'
[2] => '200397'
[3] => '200398'
)
$c->add(VmemberDetailsPeer::PERSON_ID,$x,Criteria::IN);
echo $c->toString();
$person = VmemberDetailsPeer::doSelect($c);
推进查询输出:
SELECT FROM vmember_details WHERE vmember_details.PERSON_ID IN (:p1,:p2,:p3,:p4,:p5,:p6,:p7,:p8,:p9,:p10) Params: vmember_details.PERSON_ID => '\'200407\'', vmember_details.PERSON_ID => ' \'200396\'', vmember_details.PERSON_ID => ' \'200397\'', vmember_details.PERSON_ID => ' \'200398\'', vmember_details.PERSON_ID => ' \'200399\'', vmember_details.PERSON_ID => ' \'200400\'', vmember_details.PERSON_ID => ' \'200401\'', vmember_details.PERSON_ID => ' \'200402\'', vmember_details.PERSON_ID => ' \'200403\'', vmember_details.PERSON_ID => ' \'200404\''
- 我需要传递相同的字符串 where 子句。