我是初学者,在PHP和HTML,所以我需要你的帮助。 我想显示数据从我的sql数据库创建使用phpmyadmin,到一个PHP页面。从sql数据库显示数据到apache2服务器中的html表格
我在网上搜索,发现类似的话题,但还是有问题
DB:WBAN ...
表名:杰克...
列显示:温度图,脉搏,运动...
这里是我的代码,一个空白页出现时,要求 “本地主机/ Jack.php”
<?php
$conn=mysql_connect('localhost', 'root', 'MYPASSWORD');
mysql_select_db('wban');
if(! $conn) {
die('Could not connect: ' . mysql_error());
}
$query = "SELECT * FROM Jack";
$result = mysql_query($query);
?>
<html>
<head> <title> Jack Status </title> </head>
<body>
<table width="600" border="1" cellpadding="1" cellspacing="1">
<tr> <!-- header row -->
<th>Data</th>
<th>Latest Readings</th>
<th>Average</th>
<th>Standard Deviation</th>
<th>Condition</th>
</tr>
<?php
while($row = mysql_fetch_assoc($result)){ //Create a loop to loop through results
echo "<tr>"
echo "<td>.$row['Temprature'].</td>"
echo "<td>.$row['Pulse'].</td>"
echo "<td>.$row['Motion'].</td>"
echo "</tr>"
}//end while
mysql_close(); //close out the database connection
?>
</table>
</body>
</html>
你的问题是假设你有一个工作的Web服务器。你可以让它显示简单的.html页面?它是否配置为处理PHP页面? –
http://php.net/manual/en/function.error-reporting.php –