我有 2 个文件fourm.php 和viewfourm.php
首先是fourm.php
<?php
$host="mysql13.000webhost.com"; // Host name
$username="a2670376_Users"; // Mysql username
$password="PASS"; // Mysql password
$db_name="a2670376_Pass"; // Database name
$tbl_name="fourm"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// select record from mysql
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
?>
<table>
<tr>
<td align="center"><strong>Post Number</strong></td>
<td align="center"><strong>UserName</strong></td>
<td align="center"><strong>Topic</strong></td>
<td align="center"><strong>Date</strong></td>
<td align="center"><strong>View</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><? echo $rows['fourmid']; ?> </td>
<td><? echo $rows['username']; ?> </td>
<td><? echo $rows['fourmname']; ? > </td>
<td><? echo $rows['date']; ?> </td>
<td><a href="viewfourm.php?id=<? echo $rows['fourmid']; ?>">View Topic</a></td>
<?php
// close while loop
}
?>
</tr>
</table>
<?php
// close connection;
mysql_close();
?>
<hr width='67%' color='#29001F' size='3'/>
</center>
现在查看fourm.php
<?php
$host="mysql13.000webhost.com"; // Host name
$username="a2670376_Users"; // Mysql username
$password="PASS"; // Mysql password
$db_name="a2670376_Pass"; // Database name
$tbl_name="fourm"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// select record from mysql
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
?>
<table>
<tr>
<td align="center"><strong>Post Number</strong></td>
<td align="center"><strong>UserName</strong></td>
<td align="center"><strong>Topic</strong></td>
<td align="center"><strong>Date</strong></td>
<td align="center"><strong>View</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><? echo $rows['fourmid']; ? > </td>
<td><? echo $rows['username']; ?> </td>
<td><? echo $rows['fourmname']; ? > </td>
<td><? echo $rows['date']; ?> </td>
<td><a href="fourm.php">back/a></td>
<?php
// close while loop
}
?>
</tr>
</table>
<?php
// close connection;
mysql_close();
?>
<hr width='67%' color='#29001F' size='3'/>
</center>
现在在forum.php上,当我从MySql数据库中选择什么“论坛”时,我想查看它会加载我想修复的所有论坛我知道为什么它这样做它的原因是它与第一个脚本相同,只是修改了一点我做了我能做的。我正在 MySql 数据库中选择论坛的 thruefourmid 标签,这就是“>查看主题”的含义,它应该加载带有所选 id 的论坛