php返回数据库,没有数据从PHP返回数据库

我正在构建一个PHP页面以从Azure SQL数据库读取数据。这似乎是连接和查询的作品,但我无法获得任何返回的数据显示。

我在网页上得到的输出是

Connection established.

Statement executed.

There are rows.

$connectionInfo = array( "Database"=>"sitrap", "UID"=>"xxxxxx@xxxxxx", "PWD"=>"xxxxxx");

$serverName = "tcp:xxxxxx.database.windows.net,1433";

$conn = sqlsrv_connect($serverName, $connectionInfo);

if( $conn ) {

echo "Connection established.
";

}else{

echo "Connection could not be established.
";

die( print_r( sqlsrv_errors(), true));

}

$sql = "SELECT time, callsign FROM reports";

$stmt = sqlsrv_query($conn, $sql);

if ( $stmt )

{

echo "Statement executed.
\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.
";

else

echo "There are no rows.
";

}

while ($row = sqlsrv_fetch_array($stmt))

{

?>

<?php echo $row["time"];?><?php echo $row["callsign"];?>

}

sqlsrv_free_stmt( $stmt);

sqlsrv_close( $conn);

?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值