顯示我使用下面的代碼來從一個數據庫表中的數據:PHP代碼在HTML
<!DOCTYPE HTML>
<html>
<head>
<title>Search data</title>
</head>
<body>
<table>
<tr>
<td align="center">EMPLOYEES DATA</td>
</tr>
<tr>
<td>
<table border="1">
<tr>
<td>NAME</td>
<td>EMPLOYEES<br>NUMBER</td>
<td>ADDRESS</td>
</tr>
<?php
//the example of searching data with the sequence based on the field name
//search.php
mysql_connect("localhost","root","");//database connection
mysql_select_db("db_psu_online");
$order = "SELECT * FROM tb_income_statement_igp_fields";
//order to search data
//declare in the order variable
$result = mysql_query($order);
//order executes the result is saved
//in the variable of $result
while($data = mysql_fetch_row($result)){
echo("<tr><td>$data[1]</td><td>$data[0]</td><td>$data[2]</td></tr>");
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>
以上代碼的輸出是這樣的:
我不知道爲什麼字符:"); } ?>
正在打印。
使用回聲時避免使用圓括號。我想知道它是相關的,但只是一個提示。 –