i have 2 files fourm.php and viewfourm.php
fourm.php first
<?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>
now viewfourm.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>
now on forum.php when i select what “forum” from MySql Database i want to view it loads all the forums i want to fix i know why its doing it its cause its the same script as the first one just modified a little bit but i did what i could do. i am selecting forum s thrue fourmid tag in MySql Database thats what the “>View Topic is about its supposed to load the forum with the id selected
In viewfourm.php modify your sql query
$sql="SELECT * FROM $tbl_name";like this$fourmid= $_POST['fourmid']; //if passing using get method use $_GET['fourmid'];fourmid$sql = "SELECT * FROM $tbl_name WHERE
= '$fourmid'";Also you have to pass fourmid from fourm.php to viewfourm.php
EDIT
Make a link like this
<td><a href="viewfourm.php?fourmid=<? echo $rows['fourmid']; ?>">
<? echo $rows['fourmname']; ?>
</a>
</td>