Hi! I tried creating a forum manually using PHP and succeeded in posting topics and creating new topics, the new topics can be inserted into database, but cant retrieve from database and display this new topic out, i don;t where is the problem of it. I am also unable to figure out how to reply to individual topics.
The topic code is as follows:
<paste code here>
[code=php]
$sql = "SELECT * FROM box ORDER BY time DESC LIMIT 10 ";
$result = mysql_query($sq l) or die(mysql_error ());
while ($row = mysql_fetch_arr ay($result)) {
$message = $row['message'];
$title=$row['title'];
// replace smileys by images
$sql2 = "SELECT * FROM smileys";
$result2 = mysql_query($sq l2) or die(mysql_error ());
while ($row2 = mysql_fetch_arr ay($result2)) {
$message = str_replace($ro w2['text'], "<img src = 'images/".$row2['image']."'>", $message);
}
$age = time() - $row['time'];
if ($age < 60) {
$bgcolor = "#FF0000";
} elseif ($age < 300) {
$bgcolor = "#FF4444";
} elseif ($age < 1200) {
$bgcolor = "#FF8888";
} elseif ($age < 2400) {
$bgcolor = "#FFBBBB";
} else {
$bgcolor = "#FFFFFF";
}
echo "<table width='100%' border='1' cellspacing='2' cellpadding='0' >";
echo "<tr><th width='20%'>Top ic Title</th>
<th><div align='right'>
<p align='left'>$t itle</p>
</div></th>";
echo"<tr><th width='20%'scop e='col' bgcolor=";
echo $bgcolor;
echo ">";
echo "<div align='center'> <img src='images/mact.jpg' align='center'> </div>";
echo"<br>";
echo "Time: ".date("d/m H:i", $row['time'])." ";
echo"<br>";
echo "<i>";
echo "User Name:".$row['name'];
echo"</th>";
echo"<th width='80%' align='left'>";
echo "</i> <br>";
echo $message;
echo"</th></tr>";
echo "<tr><th> </th>
<th><div align='right'>
<p align='right'>< img src='images/reply.JPG' width='14' height='16'><a href='index.php '>reply</a> <img src='images/quate.JPG' width='16' height='16'><a href='file:///C|/xampp/htdocs/fyp/forum/Tournaments.php '> Quate</a></p>
</div></th>
</table>";
[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
this is the code to retrieve the new posted topices and display new posted topics, but somehow don;t know where is wrong, the new posted topic cant be displayed.
so how should i solve this problem and how should i do reply form page?
Is any1 able to help me out please...? THANKS in advance for your help :)
The topic code is as follows:
<paste code here>
[code=php]
$sql = "SELECT * FROM box ORDER BY time DESC LIMIT 10 ";
$result = mysql_query($sq l) or die(mysql_error ());
while ($row = mysql_fetch_arr ay($result)) {
$message = $row['message'];
$title=$row['title'];
// replace smileys by images
$sql2 = "SELECT * FROM smileys";
$result2 = mysql_query($sq l2) or die(mysql_error ());
while ($row2 = mysql_fetch_arr ay($result2)) {
$message = str_replace($ro w2['text'], "<img src = 'images/".$row2['image']."'>", $message);
}
$age = time() - $row['time'];
if ($age < 60) {
$bgcolor = "#FF0000";
} elseif ($age < 300) {
$bgcolor = "#FF4444";
} elseif ($age < 1200) {
$bgcolor = "#FF8888";
} elseif ($age < 2400) {
$bgcolor = "#FFBBBB";
} else {
$bgcolor = "#FFFFFF";
}
echo "<table width='100%' border='1' cellspacing='2' cellpadding='0' >";
echo "<tr><th width='20%'>Top ic Title</th>
<th><div align='right'>
<p align='left'>$t itle</p>
</div></th>";
echo"<tr><th width='20%'scop e='col' bgcolor=";
echo $bgcolor;
echo ">";
echo "<div align='center'> <img src='images/mact.jpg' align='center'> </div>";
echo"<br>";
echo "Time: ".date("d/m H:i", $row['time'])." ";
echo"<br>";
echo "<i>";
echo "User Name:".$row['name'];
echo"</th>";
echo"<th width='80%' align='left'>";
echo "</i> <br>";
echo $message;
echo"</th></tr>";
echo "<tr><th> </th>
<th><div align='right'>
<p align='right'>< img src='images/reply.JPG' width='14' height='16'><a href='index.php '>reply</a> <img src='images/quate.JPG' width='16' height='16'><a href='file:///C|/xampp/htdocs/fyp/forum/Tournaments.php '> Quate</a></p>
</div></th>
</table>";
[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
this is the code to retrieve the new posted topices and display new posted topics, but somehow don;t know where is wrong, the new posted topic cant be displayed.
so how should i solve this problem and how should i do reply form page?
Is any1 able to help me out please...? THANKS in advance for your help :)
Comment