我試圖簡單地在PHP中使用PHP顯示視圖,但是我一直在收到和出現錯誤。任何有關T_STRING錯誤的建議?謝謝。使用PHP將數據從MySQL視圖轉換爲HTML
Parse error: syntax error, unexpected T_STRING in /home/theaudit/public_html/_sandbox/index.php on line 14
<?php
// connection parameters
$db_host="a";
$username="b";
$password="c";
$db_name="d";
// connection variables
$db_con=mysql_connect($db_host,$username,$password);
$connection_string=mysql_select_db($db_name);
// page variables
$query = SELECT * FROM a_aif_remaining;
$result = mysql_query($query);
// connection to mysql and db
mysql_connect($db_con) or die("Unable to connect to MySQL");
mysql_select_db($db_name) or die("Unable to select database");
// successful result
echo "<table border=1>
<tr>
<th>aif</th>
<th>fee_source</th>
<th>company_screename</th>
<th>filing_date</th>
<th>document_subtype</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['aif_id'] . "</td>";
echo "<td>" . $row['fee_source_id'] . "</td>";
echo "<td>" . $row['company_name_per_sedar'] . "</td>";
echo "<td>" . $row['document_filing_date'] . "</td>";
echo "<td>" . $row['document_subtype'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
忘了'」 '$ query = SELECT * FROM a_aif_remaining;'中的引號,改爲'$ query =「SELECT * FROM a_aif_remaining」;' – dbf
[參考 - 這個錯誤在PHP中意味着什麼?](http://stackoverflow.com/q/12769982/367456) – hakre
爲什麼要調用mysql_connect()兩次?第二次錯誤,我會加 –