我想顯示的數據從一個MySQL數據的HTML數據,並觀看了視頻,並跟着他們只改變什麼是必要的像表名數據庫名稱等。 我不斷收到此錯誤?簡單的MYSQL數據不顯示致命錯誤
解析錯誤:語法錯誤,意想不到 '$ SQL'(T_VARIABLE)在C:\ XAMPP \ htdocs中\ keytracker \ keytracker.php上線37
<html>
<head>
<title>SRE | Key Tracker</title>
<link rel = "stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="searchandregister">
<h2 class="cat-title">Search Booked Keys</h2>
<form method="POST" action="">
<input class="field" type="text" placeholder="Key ID" onfocus="this.placeholder=''" onblur="this.placeholder='Key ID'">
<input class="field" type="text" placeholder="Property Address" onfocus="this.placeholder=''" onblur="this.placeholder='Property Address'">
<input class="field" type="text" placeholder="Name" onfocus="this.placeholder=''" onblur="this.placeholder='Name'">
<input class="field" type="text" placeholder="Creditor" onfocus="this.placeholder=''" onblur="this.placeholder='Creditor'">
<br/><input class="button" type="submit" value="Search">
</form><br/>
<h2 class="cat-title">Book Out New Key</h2>
<form method="POST" action="">
<input class="field" type="text" placeholder="Key ID" onfocus="this.placeholder=''" onblur="this.placeholder='Key ID'">
<input class="field" type="text" placeholder="Property Address" onfocus="this.placeholder=''" onblur="this.placeholder='Property Address'">
<input class="field" type="text" placeholder="Name" onfocus="this.placeholder=''" onblur="this.placeholder='Name'">
<input class="field" type="text" placeholder="Creditor" onfocus="this.placeholder=''" onblur="this.placeholder='Creditor'">
<br/><input class="button" type="submit" value="Register">
</form>
</div>
<div class="results">
<h2 class="cat-title-right">Results</h2>
<?php
//Make connection
mysql_connect('localhost', 'access', 'AR51Bigwater');
//Select DB
mysql_select_db('keytracker')
$sql="SELECT * FROM keys";
$records = mysql_query($sql);
//Display Data
?>
<table cellpadding="1" cellspacing="1">
<tr>
<th>ID</th>
<th>Name</th>
<th>Company</th>
<th>Out_Date</th>
<th>Due_Date</th>
<tr>
<?php
while ($keys=mysql_fetch_assoc($records)){
echo "<tr>";
echo "<td>".$keys['ID']."</td>";
echo "<td>".$keys['Name']."</td>";
echo "<td>".$keys['Company']."</td>";
echo "<td>".$keys['Out_Date']."</td>";
echo "<td>".$keys['Due_Date']."</td>";
echo "</tr>";
}
?>
</table>
</div>
這是部分,其中該錯誤發生按錯誤:
<?php
//Make connection
mysql_connect('localhost', 'access', 'AR51Bigwater');
//Select DB
mysql_select_db('keytracker')
$sql="SELECT * FROM keys";
$records = mysql_query($sql);
//Display Data
?>
你在上一行缺少一個分號 –