473,388 Members | 1,385 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

how to reply to a topic for simple thread forum (PHP)

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>
Expand|Select|Wrap|Line Numbers
  1. $sql = "SELECT * FROM box ORDER BY time DESC LIMIT 10 ";
  2.     $result = mysql_query($sql) or die(mysql_error());
  3.     while ($row = mysql_fetch_array($result)) {
  4.         $message = $row['message'];
  5.         $title=$row['title'];
  6.         // replace smileys by images
  7.         $sql2 = "SELECT * FROM smileys";
  8.         $result2 = mysql_query($sql2) or die(mysql_error());
  9.         while ($row2 = mysql_fetch_array($result2)) {
  10.             $message = str_replace($row2['text'], "<img src = 'images/".$row2['image']."'>", $message);
  11.         }
  12.         $age = time() - $row['time'];
  13.         if ($age < 60) {
  14.             $bgcolor = "#FF0000";
  15.         } elseif ($age < 300) {
  16.             $bgcolor = "#FF4444";
  17.         } elseif ($age < 1200) {
  18.             $bgcolor = "#FF8888";
  19.         } elseif ($age < 2400) {
  20.             $bgcolor = "#FFBBBB";
  21.         } else {
  22.             $bgcolor = "#FFFFFF";
  23.         }
  24.  
  25.         echo "<table width='100%'  border='1' cellspacing='2' cellpadding='0'>";
  26.         echo "<tr><th width='20%'>Topic Title</th>
  27.         <th><div align='right'>
  28.     <p align='left'>$title</p>
  29.     </div></th>";
  30.         echo"<tr><th width='20%'scope='col' bgcolor=";
  31.         echo $bgcolor;
  32.         echo ">";
  33.         echo "<div align='center'><img src='images/mact.jpg' align='center'></div>";
  34.         echo"<br>";
  35.         echo "Time: ".date("d/m H:i", $row['time'])." ";
  36.         echo"<br>";
  37.         echo "<i>";
  38.  
  39.         echo "User Name:".$row['name'];
  40.  
  41.         echo"</th>";
  42.         echo"<th width='80%' align='left'>";
  43.         echo "</i> <br>";
  44.  
  45.         echo $message;
  46.         echo"</th></tr>";
  47.         echo "<tr><th>&nbsp;</th>
  48.         <th><div align='right'>
  49.     <p align='right'><img src='images/reply.JPG' width='14' height='16'><a href='index.php'>reply</a>&nbsp;<img src='images/quate.JPG' width='16' height='16'><a href='file:///C|/xampp/htdocs/fyp/forum/Tournaments.php'> Quate</a></p>
  50.     </div></th>
  51.         </table>";
  52.  
[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 :)
Jun 27 '07 #1
1 2165
nathj
938 Expert 512MB
It might be helpful to have some idea of the data structure you are using, as we are really talking about specific data retreival. Unless I have misunderstood the question, in which case my apologies, perhaps you could provide further explanation.

Also , it makes the post easier to read if you put the code tags around the code you are posting.

Let me know and I'll try to help.
Cheers
Nathan
Jun 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Khamal | last post by:
Hello... The quality of reply is quite bad in this forum.....many post has not reply.... I/We need Microsoft technical team involve directly in this forum and put some effort to give us HELP. If...
3
by: kang jia | last post by:
hi i am doing reply page for forum, users can reply for the specific topic they would like to reply. Firstly of all, when click the topic name in topic page. i will redirect them to reply page....
5
helimeef
by: helimeef | last post by:
I designed a little PHP/MySQL forum (just for fun), and I have commenting set up and top threads on the homepage and whatnot. I'm relatively new to PHP, and this is the biggest project I've done, but...
0
by: ramuda | last post by:
Perhaps this is off topic, perhaps not. I'm using Moodle to make an online course teaching elementary Web Development with PHP. To make a course like this, students have to be introduced to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.