PHP中如何在单引号内传递变量
我需要从当前日期开始取一个月内发行的图书数量,这就是为什么我需要这样运行:PHP中如何在单引号内传递变量,php,sql,Php,Sql,我需要从当前日期开始取一个月内发行的图书数量,这就是为什么我需要这样运行: "SELECT * from issued_books where student_id= :s_id and book_name = :b_name and issue_date between :start_date and :end_date" 但在这两者之间,我需要传递'2019-02-27',但我的变量给出了2019-02-27。如何解决此问题?尝试以下方法: $variable = "'2019-02-27
"SELECT * from issued_books where student_id= :s_id and book_name = :b_name and issue_date between :start_date and :end_date"
但在这两者之间,我需要传递'2019-02-27'
,但我的变量给出了2019-02-27
。如何解决此问题?尝试以下方法:
$variable = "'2019-02-27'"; // will return '2019-02-27'
或
或
应该是这样的。通过concatationPls给我举个例子@Treybake你尝试过什么吗?对于准备好的语句,你不需要将变量括在引号中。你试过了吗?@Md.Iqbal嗯,你需要向我们展示你的代码,并准确解释它是如何工作的。我建议你先阅读,然后再阅读你的帖子。
$issue_date = "'".$issue_date."'";
"SELECT * from issued_books where student_id= :s_id and book_name = :b_name and {issue_date} between :start_date and :end_date"
$var = "2019-43-43";
"fsdafsdf fsd fsd '{$var}'";
$var = "'2019-43-43'";
"fsdafsdf fsd fsd ".$var;