我从最后一小时开始拔头发。两个查询一个是直接在mysql上运行结果很好但是从php它缺少一条记录。我不知道为什么? 在PHP
$sql = "SELECT * FROM switch_person WHERE Half = ".$half." AND EmployeeNamePK = ".$pk." AND SwitchDate = CURDATE() order by PTPK";
echo "<br>".$sql."<br>";
$outputArray = array();
$result = mysql_query($sql,$con) or die(mysql_error());
while($emp = mysql_fetch_assoc(($result))){
$outputArray[] = $emp["PTPK"];
echo $emp["PTPK"],"</br>",$emp["PK"],"</br>";
}
在sql中
SELECT * FROM switch_person WHERE Half = 2 AND
EmployeeNamePK = 2 AND SwitchDate = CURDATE() order by PTPK