<php
$sql = "SELECT * FROM officer WHERE";//ค้นหาจากชื่อหรือสกุล
if($txt1!=""&&$txt2!=""){
$sql.=" (Name LIKE '%".$txt1."%' OR Lastname LIKE '%".$txt1."%') AND ID_card_number ='$txt2'";
}else if($txt1!=""){
$sql.=" (Name LIKE '%".$txt1."%' OR Lastname LIKE '%".$txt1."%')";
}else if($txt2!=""){
$sql.=" ID_card_number ='$txt2'";
}
?>