我无法从PHP连接我的sql server,请帮助我告诉我哪里出错了?
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<?php
$servername = "x.x.x.x";
$username = "xx";
$password = "xxxxx";
// Create connection
$conn = mysqli_connect($servername, $username, $password);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
else {
echo"Succesfull";
}
$sql = "SELECT TOP 1000 [Service_provider],[Account_No],[MDN_No],
[IP_Address],[Sim_No],[Status],[RatePlan] ,[Sim_Type FROM [Sampledata].
[dbo].[sampletableforsimcardstatus]";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table><tr><th>Account_No</th><th>Service_provider</th>
<th>MDN_No</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["Account_No"]. "</td><td>" .
$row["Service_provider"]. " " . $row["MDN_No"]. "</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>
</body>
</html>
我将代码写在网页上作为输出:
ERROR:
查询(SQL $); if($ result-&gt; num_rows&gt; 0){echo&#34;&#34 ;; //输出数据 每一行($ row = $ result-&gt; fetch_assoc()){echo&#34;&#34 ;;回声&#34; Account_No Service_provider MDN_No&#34; 。 $行[&#34; account_no上&#34]。 &#34; &#34; 。 $行[&#34; SERVICE_PROVIDER&#34]。 &#34; &#34; 。 $行[&#34; MDN_No&#34]。 &#34; &#34 ;; } else {echo&#34; 0 结果&#34 ;; } $ conn-&gt; close(); ?&GT;