我正在尝试使用php从sql获取数据。但是检索日期值时出现错误500。检索其他类型的数据时没有错误。
谁能告诉我为什么会这样?
单元格中的值:“ 1999/12/31 16:01:05.000”
Windows Server
$tsql = "
SELECT
ProgramName,
RepeatID,
Round(ScrapFraction*100,2) As Yeld,
MachineName,
Round(CuttingTime*60,2) AS CuttingTimeMins,
PostDateTime,
PostedByUserID,
Thickness,
Material,
PostDateTime
FROM
dbo.Program";
/* Execute the query. */
$stmt = sqlsrv_query( $conn, $tsql);
if ( $stmt )
{
//echo "Statement executed.<br>\n";
}
else
{
echo "Error in statement execution.\n";
die( print_r( sqlsrv_errors(), true));
}
echo "<Table width='1200' border='1'>";
echo "<tr>";
echo "<Td>Program Name</td>";
echo "<Td>Repeat</td>";
echo "<Td>Yeld</td>";
echo "<Td>MachineName</td>";
echo "<Td>Cutting Time</td>";
echo "<Td>PostedBy</td>";
echo "<Td>Thickness</td>";
echo "<Td>Material</td>";
echo "<Td>data</td>";
echo "</tr>";
while( $row = sqlsrv_fetch_array($stmt))
{
echo "<tr>";
echo "<Td><a href='xa.php?revice=".$row['ProgramName']."'>".$row['ProgramName']."</a></td>";
echo "<Td><center>".$row['RepeatID']."</center></td>";
echo "<Td><center>".$row['Yeld']."%</center></td>";
echo "<Td>".$row['MachineName']."</td>";
echo "<Td>".$row['CuttingTimeMins']."</td>";
echo "<Td><center>".$row['PostedByUserID']."</td>";
echo "<Td><center>".$row['Thickness']."</center></td>";
echo "<Td><center>".$row['Material']."</center></td>";
echo "</tr>";
}
/* Free statement and connection resources. */
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);