我有一个SMQL选择查询,它从MS Sql服务器检索数据,但是在mssql_query
之后,我尝试通过一个使用mssql_fetch
数组的循环来获取它,但似乎它正在跳过获取部分。这是我的代码。
<?php
session_start();
$account = $_REQUEST['name'];
?>
<html>
<head></head>
<body>
<div>
<?php
echo "<table border='1' cellpadding='5' width='100%''>";
echo "<tr><th>No.</th><th>Location</th><th>Engine</th> <th>Time</th></tr>";
// Loop through database
$sql = "SELECT * FROM locations where name = '$account' order by time desc";
//die($sql);
$result = mssql_query($sql);
while ($row = mssql_fetch_array($result)) {
$id = $row['id'];
$location = $row['address'];
$engine = $row['description'];
$time = $row['time'];
// Show entries
echo "<tr>
<td>".$id."</td>
<td>".$location."</td>
<td>".$engine."</td>
<td>".$time."</td>
</tr>";
}
echo "</table>";
?>
</div>
</body>