我有这张桌子
date | Expedition | Destination
________________________________________
12/05/2012 | UPS | New York
12/05/2012 | DHL | New York
13/06/2012 | ATLAS | Atlanta
14/06/2012 | JNE | Chicago
我想创建搜索结果和我的代码
<form method="post" action="sales.php?ID=expLocal">
Pencarian <input type="text" name="KUNCI" width="300"/><input type="submit" name="CARI" value="CARI" />
</form>
<?php
if (empty($_POST[CARI]))
{
$sql = "SELECT * FROM tb_exp_local";//this query for open all the data
}
else if (isset($_POST[KUNCI]))
{
$kunci=$_POST[KUNCI];
$sql="SELECT * FROM tb_exp_local WHERE MATCH (expedition,destination,date) AGAINST ('+$kunci' IN BOOLEAN MODE)"; // this is query for serching the data
}
?>
查询运行良好,但如果搜索框中填充了日期,则查询不会运行。谁能告诉我如何纠正这个问题?(列日期的数据类型是varchar)
答案 0 :(得分:1)
答案 1 :(得分:1)
CARI和KUNCI是否定义在sales.php的任何位置?
否则您需要使用
检查其值