-1
有我的查询字符串,有没有关于bindParam的任何问题?Mysql查询选项参数
$str = "select A.option_id,count(*) as sum
from tb_feedback A,tb_question B,tb_group C
where (A.question_id=B.id)
and (:question is null or B.id=:question)
and (B.group_num=C.id)
and (:group is null or C.name=:group)
and (:fromdate is null or A.date >= CAST(:fromdate AS DATE))
and (:todate is null or A.date <= CAST(:todate AS DATE))
group by A.option_id";
$sql = $this->conn->prepare($str);
$sql->bindParam(':question', $obj['question']);
$sql->bindParam(':group', $obj['group']);
$sql->bindParam(':fromdate', $obj['fromdate']);
$sql->bindParam(':todate', $obj['todate']);
优良似乎它没有成功,为什么ü问? – Borik 2015-03-13 17:21:59
你为什么觉得有问题?你有错误吗? – Mureinik 2015-03-13 17:31:33
@Mureinik耶,看起来不错,但运行我的程序,它返回null,实际上有一些记录存在于我的dasebase – 2015-03-13 17:37:47