下面是我的查詢如何PHP變量值添加到查詢之間
public function total_registration_month($from1,$to1){
$q = $this->link->prepare('SELECT advisor, COUNT(*) as total
FROM
(
SELECT advisor
FROM training_details
WHERE ndate BETWEEN $from1 AND $to1
UNION ALL
SELECT advisor
FROM student_details
WHERE registereddate
BETWEEN $from1 AND $to1
) AS advisor
GROUP BY advisor');
$q->execute();
$count = $q->fetchall();
return $count;
}
我如何添加THT順利通過1跳轉和TO1從日期和date.If重視,往來成我申請的變量照片直接或單一相當它顯示錯誤。善良幫助我的人。
您正在使用'prepare',但沒有真正使用它。閱讀[文檔](http://php.net/manual/en/pdo.prepare.php)。有很多如何正確執行此操作的示例,這些示例還將解決您的問題。 –
你使用PDO或mysqli_數據庫訪問API嗎? – RiggsFolly
我使用PDO數據庫訪問 –