php 沒有 now() 方法,now()是mysql中的方法 你可以這樣寫 1.不使用 bindParamselect * from table where a =now();這樣即可。2.如果一定要使用bindParam,因为bindParam()的第二个参数是传址的。所以先赋给变量就可以了。<?php $query = "select * from table where a =:a"; $now = date('Y-m-d H:i:s'); $stm->bindParam(":a", $now); $stm->execute(); ?>
你可以這樣寫
1.不使用 bindParamselect * from table where a =now();這樣即可。2.如果一定要使用bindParam,因为bindParam()的第二个参数是传址的。所以先赋给变量就可以了。<?php
$query = "select * from table where a =:a";
$now = date('Y-m-d H:i:s');
$stm->bindParam(":a", $now);
$stm->execute();
?>