0
我正在構建一個PHP頁面從Azure SQL數據庫讀取數據。這似乎是連接和查詢的作品,但我無法獲得任何返回的數據顯示。沒有數據從php返回數據
我得到的網頁上的輸出是建立
連接。 聲明已執行。 有行。
<?php
$connectionInfo = array("Database"=>"sitrap", "UID"=>"[email protected]", "PWD"=>"xxxxxx");
$serverName = "tcp:xxxxxx.database.windows.net,1433";
$conn = sqlsrv_connect($serverName, $connectionInfo);
if($conn) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die(print_r(sqlsrv_errors(), true));
}
$sql = "SELECT time, callsign FROM reports";
$stmt = sqlsrv_query($conn, $sql);
if ($stmt)
{
echo "Statement executed.<br>\n";
}
else
{
echo "Error in statement execution.\n";
die(print_r(sqlsrv_errors(), true));
}
if ($stmt) {
$rows = sqlsrv_has_rows($stmt);
if ($rows === true)
echo "There are rows. <br />";
else
echo "There are no rows. <br />";
}
while ($row = sqlsrv_fetch_array($stmt))
{
?>
<tr>
<td><?php echo $row["time"];?></td>
<td><?php echo $row["callsign"];?></td>
</tr>
<?php
}
sqlsrv_free_stmt($stmt);
sqlsrv_close($conn);
?>
如果您查看源代碼html代碼 - 是否有'tr-td'標記? –
現在確定我明白你的意思。但在源代碼中有