。php文件-HTML未显示

问题描述 投票:-1回答:1

我有一个大问题,我不知道怎么了。我为论坛制作了PHP脚本,并对其进行了测试,并且该脚本可以正常工作。但是,我想重新设计从到。现在没有显示。我的代码:

<!DOCTYPE html>
<html>
<head>
<title>Maratonec - Forums</title>
</head>
<body>
<?php

$host="hidden"; // Host name 
$username="hidden"; // Mysql username 
$password="hidden"; // Mysql password 
$db_name="hidden"; // Database name 
$tbl_name="hidden"; // Table name 

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name ORDER BY id DESC";
// OREDER BY id DESC is order result by descending

$result=mysql_query($sql);
?>
<div>
<h1>Forums</h1>
<p>
Here you can post you question and if you know answer for some question you cna answer it!
</p>
</div>
<?php

// Start looping table row
while($rows=mysql_fetch_array($result)){
?>

<h3><? echo $rows['topic']</h3>
<div style="background-color:silver">
<p> <? echo $rows['detail']; ?></p>
<p> By: <? echo $rows['name']; ?></p>
<a href="view_topic.php?id=<? echo $rows['id']; ?>">View answers on <? echo $rows['topic']; ?></p>
<p> From: <? echo rows['reply']; ?></p>
</div>

<?php
// Exit looping and close connection 
}
mysql_close();
?>
<table>
<tr>
<td colspan="5" align="right" bgcolor="#E6E6E6"><a href="create_topic.php"><strong>Create New Topic</strong></a></td>
</tr>
</table>
</body>
</html>

我不对PHP进行任何更改。我要做的是将标题命名为主题名称及其描述的部分。每个部分都将在标签中。你能帮我么?我是PHP的初学者,而HTML的初学者则略少。

php html mysql
1个回答
0
投票

第35行:您在echo $rows['topic']之后没有关闭php标记>

© www.soinside.com 2019 - 2024. All rights reserved.