布尔值未通过 Symfony 插入
Boolean value not inserted through Symfony
在 pgadminIII 中执行更新语句时,它的工作正常 false 正在更新列值
update tbl_student_colleges set target=false where id=9
当对 Symfony 脚本值执行相同操作时,True 值可以正常工作,但如果为 false 则不起作用。
$apptQuery = "insert into tbl_student_colleges (student_id,college_id,college_name,target,applied,accepted,attending,scholarship,created_at,created_by_id,updated_at,updated_by_id) values(:returnID,:collegeId,:collegeName,:target,:applied,:accepted,:attending,:scholarship,:date,:loggedinUser,:date,:loggedinUser)";
$em = $this->getDoctrine()->getEntityManager();
$Querystatement = $em->getConnection()->prepare($apptQuery);
$Querystatement->bindValue('returnID', $returnID);
$Querystatement->bindValue('collegeId', '2472363');//2472363
$Querystatement->bindValue('collegeName', $school->college_name);
$Querystatement->bindValue('target', $school->target == 1 ? TRUE : FALSE);
$Querystatement->bindValue('applied', $school->applied == 1 ? TRUE : FALSE);
$Querystatement->bindValue('accepted', $school->accepted == 1 ? TRUE : FALSE);
$Querystatement->bindValue('attending', $school->attending == 1 ? TRUE : FALSE);
$Querystatement->bindValue('scholarship', $school->scholarship);
$Querystatement->bindValue('date', $date);
$Querystatement->bindValue('loggedinUser', $loggedinUser);
$Querystatement->execute();
使用 0 而不是 false,看看它是否有效
在 pgadminIII 中执行更新语句时,它的工作正常 false 正在更新列值
update tbl_student_colleges set target=false where id=9
当对 Symfony 脚本值执行相同操作时,True 值可以正常工作,但如果为 false 则不起作用。
$apptQuery = "insert into tbl_student_colleges (student_id,college_id,college_name,target,applied,accepted,attending,scholarship,created_at,created_by_id,updated_at,updated_by_id) values(:returnID,:collegeId,:collegeName,:target,:applied,:accepted,:attending,:scholarship,:date,:loggedinUser,:date,:loggedinUser)";
$em = $this->getDoctrine()->getEntityManager();
$Querystatement = $em->getConnection()->prepare($apptQuery);
$Querystatement->bindValue('returnID', $returnID);
$Querystatement->bindValue('collegeId', '2472363');//2472363
$Querystatement->bindValue('collegeName', $school->college_name);
$Querystatement->bindValue('target', $school->target == 1 ? TRUE : FALSE);
$Querystatement->bindValue('applied', $school->applied == 1 ? TRUE : FALSE);
$Querystatement->bindValue('accepted', $school->accepted == 1 ? TRUE : FALSE);
$Querystatement->bindValue('attending', $school->attending == 1 ? TRUE : FALSE);
$Querystatement->bindValue('scholarship', $school->scholarship);
$Querystatement->bindValue('date', $date);
$Querystatement->bindValue('loggedinUser', $loggedinUser);
$Querystatement->execute();
使用 0 而不是 false,看看它是否有效