注意:在查询

时间:2017-03-21 03:04:51

标签: php mysql drupal

$ awal和$ akhir是datetime,用户插入手册但收到错误。我希望有人能帮我解决这个问题。

这是代码

$sql_hit="SELECT count(*) FROM komitmen k,relasibisnis r WHERE
k.tgl_bukti BETWEEN '$awal' AND '$akhir'
AND r.koderelasi=k.relasi
AND k.status_komitmen=0 $sqlmpp $umur";

$sql="select k.*,r.namarelasi
from komitmen k,relasibisnis r WHERE
k.tgl_bukti BETWEEN '$awal' AND '$akhir'
and r.koderelasi=k.relasi
and k.status_komitmen=0 $sqlmpp $umur";         

$hasil=pager_query($sql,40,0,$sql_hit);

1 个答案:

答案 0 :(得分:0)

以下是$ awal和$ akhir的<{3}}基本示例 -

$sql = "SELECT count(*) FROM komitmen k,relasibisnis r WHERE k.tgl_bukti BETWEEN :awal AND :akhir";

$query = db_query($sql, array(':awal' => $awa, ':akhir' => $akhir));

希望!它会对你有所帮助。