pocobueno1388 Posted August 19, 2006 Share Posted August 19, 2006 I have coded a forum script which pretty much works just like this one on PHPfreaks. The only thing I am not sure on is how to make it to where if somone posts a reply on a board, the topic will be 'bumped' up to the top of the page...I have no idea where to start on this one, so you may have to explain in detail, lol. Thanks XD Quote Link to comment Share on other sites More sharing options...
Woolf Posted August 19, 2006 Share Posted August 19, 2006 Well, I have never really gotten into forum software yet (seems I'm always coding a website or other project), so I'm not sure this is necessarily the 'best' way to go. However, this is how I would do it.I am going to assume you already have a topic table and a post table. It not, you'd better set that stuff up beforehand. :PAnyway, in your topic table, create a column called 'last_post' (or something like that). Then, in your script... whenever someone adds a new post, make it update the last_post column for the specified row in the topics table with the current time.EDIT: Then, in your topic listing script (where it lists all the topics for the specified category/forum), instead of ordering them by ID or whatever, order them by last_post (descending of course). :) Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted August 19, 2006 Author Share Posted August 19, 2006 Oh wow, that would work great. Thanks for your help.If anyone else has any other suggestions, please list them. Although, I think Woolf's idea would get the job done just fine XD Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted August 19, 2006 Author Share Posted August 19, 2006 Okay, I am having one problem now.The first row of the database does not show up on the boards. But when I bump a post, the post that should be at the top goes away because it is now supposed to be the first thing to show up. I am not sure how to fix this with out posting the entire script to my forums. So I guess that is what I am going to do.Here is the code to post.php:[code]<?include 'header.php';//*Check to see if the form was submited then add the form to the database*//if ($_POST['post']){$subject = trim(addslashes($_POST['subject']));$body = trim(addslashes($_POST['body']));$category = trim(strip_tags($_POST['category']));//*Check if they filled everything out*//if (($subject == "") || ($body == "")){ echo "You must fill out all fields!";} else {echo "<table width='80%' bgcolor='49614A'><td align='center' bgcolor='788D7A'><b>Successfully Posted!</b></td></table>";mysql_query("INSERT INTO forum (subject, body, category, posterID, time) VALUES ('$subject','$body', '$_GET[board]', '$sid', NOW() )") or die(mysql_error()); }}//*Print post form*//print<<<HERE<p><h2>Post A Topic</h2><a href="http://northlakestables.com/dog/boards.php?board=$_GET[board]">Go back to board</a><p><form action="post.php?board=$_GET[board]&action=post" method="POST"><table bgcolor='788D7A'><td>Subject: <input type=text name="subject" maxlength=50></td><tr><td><br>Category: $_GET[board]</td></tr><td><br>Post:<br><textarea rows=10 cols=50 name="body"></textarea><p></td></tr><td align="center"><input type="submit" name="post" value="Submit"></td></table></form>HERE;?>[/code]This allows the user to create a topic, which the is displayed on boards.php:[code]<?include 'header.php';//*Check if they submited a reply then add it to the database if submited correctly*//if ($_POST['reply']){$topic1 = $_GET['topicID'];$reply_body = trim(addslashes($_POST['reply_body']));if ($reply_body == ""){ echo "You must fill out all fields!";} else {mysql_query("UPDATE `forum` SET `posts` = posts+1, time=NOW() WHERE `topicID` ='$_GET[topicID]' LIMIT 1 ;")or die("Cannot update! " . mysql_error());echo "<table width='80%' bgcolor='49614A'><td align='center' bgcolor='788D7A'><b>Successfully replied!</b></td></table><p>";mysql_query("INSERT INTO replies (topicID, posterID, body, time) VALUES ('$topic1','$sid', '$reply_body', NOW() )") or die(mysql_error()); }}//*If they want to read the post*//$topic = $_GET['topicID'];if ($topic){$sql2 = "SELECT posterID, topicID, subject, body FROM forum WHERE topicID='$topic'";$result2 = mysql_query($sql2);$forum1 = mysql_fetch_array($result2);$sql4 = "SELECT topicID, posterID, body FROM replies WHERE topicID='$topic'";$result4 = mysql_query($sql4);$sql1 = "SELECT playerID, username FROM players WHERE playerID='$forum1[posterID]'";$result1 = mysql_query($sql1);$player = mysql_fetch_array($result1);print<<<HERE<a href="http://northlakestables.com/dog/boards.php?board=$_GET[board]">Go back to board</a><p><table width="90%" bgcolor="49614A"><tr bgcolor="607062"><td><b>Subject:</b> $forum1[subject]</td><tr bgcolor="607062"><td align="center"><br><p align="left"><b>Posted By:</b> <a href="viewprofile.php?profileid=$player[playerID]">$player[username]</a></p>$forum1[body]</td>HERE;while ($reply4 = mysql_fetch_array($result4)){$sql6 = "SELECT playerID, username FROM players WHERE playerID='$reply4[posterID]'";$result6 = mysql_query($sql6);$player1 = mysql_fetch_array($result6); echo '<tr bgcolor="788D7A">'; echo "<td align='center'><p align='left'><b>Posted By: </b><a href='viewprofile.php?profileid=$player1[playerID]'>$player1[username]</a></p>"; echo "$reply4[body]</td><tr>";}print<<<HERE<tr bgcolor="788D7A"><td align="center"><form action="boards.php?action=reply&board=$_GET[board]&topicID=$topic" method="POST"><h3>Add a reply</h3><textarea rows=10 cols=50 name="reply_body"></textarea><p><input name="reply" type="submit" value="Reply"></form></td></table>HERE;exit;}$general = $_GET['board'];if ($general == general){echo "<h2>General Board</h2>";printboards();exit;} else if ($general == advertise){echo "<h2>Advertising Board</h2>";printboards();exit;} else if ($general == buying){echo "<h2>Buying/Selling Board</h2>";printboards();exit;} else if ($general == art){echo "<h2>Art Board</h2>";printboards();exit;} else if ($general == help){echo "<h2>Help Board</h2>";printboards();exit;} else if ($general == contests){echo "<h2>Contests Board</h2>";printboards();exit;} else if ($general == suggestions){echo "<h2>Suggestions Board</h2>";printboards();exit;}//*Chat list*//print<<<HERE<h1>The Boards</h1><table bgcolor="49614A" cellspacing=7><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=general"><b>General</b></a><br>Talk about anything here XD</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=advertise"><b>Advertise</b></a><br>Here is where you can advertise your dogs, shops, etc.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=buying"><b>buying/selling</b></a><br>Sell and buy things here.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=art"><b>Art</b></a><br>Show off your art here.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=help"><b>help</b></a><br>Need help? Get your answers here.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=contests"><b>Contests</b></a><br>Hold a contest here.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=suggestions"><b>Suggestions</b></a><br>Have a good suggestion for the site? Share it here.</td>HERE;//*Define function*//function printboards(){//*Queries*//$sql = "SELECT * FROM forum WHERE category='$_GET[board]' ORDER BY time DESC";$result = mysql_query($sql);$forum = mysql_fetch_array($result);//*Print out forum*//print<<<HERE<a href="post.php?board=$_GET[board]">New Topic</a><p><br><table width="90%" bgcolor='49614A'><tr bgcolor='49614A' align="center"><th><b>Subject</b></th><th><b>Posts</b></th><th><b>Starter</b></th><th><b>Time</b></th><tr bgcolor='788D7A' align="center">HERE;while ($forum = mysql_fetch_array($result)){$sql1 = "SELECT playerID, username FROM players WHERE playerID='$forum[posterID]'";$result1 = mysql_query($sql1);$player = mysql_fetch_array($result1); echo "<td><a href='boards.php?board=$_GET[board]&topicID=$forum[topicID]'>$forum[subject]</a></td>"; echo "<td>$forum[posts]</td>"; echo "<td><a href='viewprofile.php?profileid=$player[playerID]'>$player[username]</a></td>"; echo "<td>$forum[time]</td>"; echo "<tr bgcolor='788D7A' align='center'>";}print<<<HERE</table>HERE;}?>[/code]This is where all the posts are listed, and it also allows the user to choose which board they would like to enter. If you would like to see the output to the scripts <a href="http://northlakestables.com/dog/">CLICK HERE</a>. If you would not like to join, just login with 'guest' as the login and password.Then just click on the link called 'Boards'...and it will take you to boards.phpEDIT: Oops, I forgot my database info.<u>TABLE 'forum'</u>topicIDposterIDsubjectbodycategorypoststime<u>TABLE 'replies'</u>replyIDtopicIDposterIDbodytime Quote Link to comment Share on other sites More sharing options...
Yesideez Posted August 19, 2006 Share Posted August 19, 2006 Without looking through all that code have a check to make sure you're not doing something like this:[code]$query=mysql_query("SELECT * FROM replies ORDER BY `lastreply` LIMIT ".$offset.",".$pagelen." DESC");$reply=mysql_fetch_array($query);while ($reply=mysql_fetch_array($query)) { show the reply here}[/code]A friend did that in their code and it took someone else to point out that the second line was pulling out the first entry and doing nothing with it. I told them to delete the line and everything worked fine.Are you pulling out the first record by accident then jumping into a loop? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted August 19, 2006 Author Share Posted August 19, 2006 This kinda looks like what you just posted...[code]while ($forum = mysql_fetch_array($result)){$sql1 = "SELECT playerID, username FROM players WHERE playerID='$forum[posterID]'";$result1 = mysql_query($sql1);$player = mysql_fetch_array($result1); echo "<td><a href='boards.php?board=$_GET[board]&topicID=$forum[topicID]'>$forum[subject]</a></td>"; echo "<td>$forum[posts]</td>"; echo "<td><a href='viewprofile.php?profileid=$player[playerID]'>$player[username]</a></td>"; echo "<td>$forum[time]</td>"; echo "<tr bgcolor='788D7A' align='center'>";}[/code]What could I do to fix that though? I need the while loop..And no, I don't think I am pulling the first record by accident anywhere 0_o Quote Link to comment Share on other sites More sharing options...
Yesideez Posted August 19, 2006 Share Posted August 19, 2006 I *think* this is what you want:[code]$sql1 = "SELECT playerID, username FROM players WHERE playerID='$forum[posterID]'";$result1 = mysql_query($sql1);while ($forum = mysql_fetch_array($result)){ echo "<td><a href='boards.php?board=$_GET[board]&topicID=$forum[topicID]'>$forum[subject]</a></td>"; echo "<td>$forum[posts]</td>"; echo "<td><a href='viewprofile.php?profileid=$player[playerID]'>$player[username]</a></td>"; echo "<td>$forum[time]</td>"; echo "<tr bgcolor='788D7A' align='center'>";}[/code] Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted August 20, 2006 Author Share Posted August 20, 2006 Nope =/ That gives me the same result. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted August 20, 2006 Share Posted August 20, 2006 There isn't a "system" that manages the "bumps". The way that it works is by storing all of the threads and responses in a table, when the page it loaded, it grabs the last however-many-threads-are-on-a-page ordered by time. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted August 20, 2006 Author Share Posted August 20, 2006 Hitman - Yes, that question has already been answered and I already have it up and working. Now we are trying to fix some other errors that I have. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted August 20, 2006 Author Share Posted August 20, 2006 bump Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 20, 2006 Share Posted August 20, 2006 what errors you got then ok not bump! Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted August 20, 2006 Author Share Posted August 20, 2006 [quote author=pocobueno1388 link=topic=104827.msg418690#msg418690 date=1156029110]Okay, I am having one problem now.The first row of the database does not show up on the boards. But when I bump a post, the post that should be at the top goes away because it is now supposed to be the first thing to show up. I am not sure how to fix this with out posting the entire script to my forums. So I guess that is what I am going to do.Here is the code to post.php:[code]<?include 'header.php';//*Check to see if the form was submited then add the form to the database*//if ($_POST['post']){$subject = trim(addslashes($_POST['subject']));$body = trim(addslashes($_POST['body']));$category = trim(strip_tags($_POST['category']));//*Check if they filled everything out*//if (($subject == "") || ($body == "")){ echo "You must fill out all fields!";} else {echo "<table width='80%' bgcolor='49614A'><td align='center' bgcolor='788D7A'><b>Successfully Posted!</b></td></table>";mysql_query("INSERT INTO forum (subject, body, category, posterID, time) VALUES ('$subject','$body', '$_GET[board]', '$sid', NOW() )") or die(mysql_error()); }}//*Print post form*//print<<<HERE<p><h2>Post A Topic</h2><a href="http://northlakestables.com/dog/boards.php?board=$_GET[board]">Go back to board</a><p><form action="post.php?board=$_GET[board]&action=post" method="POST"><table bgcolor='788D7A'><td>Subject: <input type=text name="subject" maxlength=50></td><tr><td><br>Category: $_GET[board]</td></tr><td><br>Post:<br><textarea rows=10 cols=50 name="body"></textarea><p></td></tr><td align="center"><input type="submit" name="post" value="Submit"></td></table></form>HERE;?>[/code]This allows the user to create a topic, which the is displayed on boards.php:[code]<?include 'header.php';//*Check if they submited a reply then add it to the database if submited correctly*//if ($_POST['reply']){$topic1 = $_GET['topicID'];$reply_body = trim(addslashes($_POST['reply_body']));if ($reply_body == ""){ echo "You must fill out all fields!";} else {mysql_query("UPDATE `forum` SET `posts` = posts+1, time=NOW() WHERE `topicID` ='$_GET[topicID]' LIMIT 1 ;")or die("Cannot update! " . mysql_error());echo "<table width='80%' bgcolor='49614A'><td align='center' bgcolor='788D7A'><b>Successfully replied!</b></td></table><p>";mysql_query("INSERT INTO replies (topicID, posterID, body, time) VALUES ('$topic1','$sid', '$reply_body', NOW() )") or die(mysql_error()); }}//*If they want to read the post*//$topic = $_GET['topicID'];if ($topic){$sql2 = "SELECT posterID, topicID, subject, body FROM forum WHERE topicID='$topic'";$result2 = mysql_query($sql2);$forum1 = mysql_fetch_array($result2);$sql4 = "SELECT topicID, posterID, body FROM replies WHERE topicID='$topic'";$result4 = mysql_query($sql4);$sql1 = "SELECT playerID, username FROM players WHERE playerID='$forum1[posterID]'";$result1 = mysql_query($sql1);$player = mysql_fetch_array($result1);print<<<HERE<a href="http://northlakestables.com/dog/boards.php?board=$_GET[board]">Go back to board</a><p><table width="90%" bgcolor="49614A"><tr bgcolor="607062"><td><b>Subject:</b> $forum1[subject]</td><tr bgcolor="607062"><td align="center"><br><p align="left"><b>Posted By:</b> <a href="viewprofile.php?profileid=$player[playerID]">$player[username]</a></p>$forum1[body]</td>HERE;while ($reply4 = mysql_fetch_array($result4)){$sql6 = "SELECT playerID, username FROM players WHERE playerID='$reply4[posterID]'";$result6 = mysql_query($sql6);$player1 = mysql_fetch_array($result6); echo '<tr bgcolor="788D7A">'; echo "<td align='center'><p align='left'><b>Posted By: </b><a href='viewprofile.php?profileid=$player1[playerID]'>$player1[username]</a></p>"; echo "$reply4[body]</td><tr>";}print<<<HERE<tr bgcolor="788D7A"><td align="center"><form action="boards.php?action=reply&board=$_GET[board]&topicID=$topic" method="POST"><h3>Add a reply</h3><textarea rows=10 cols=50 name="reply_body"></textarea><p><input name="reply" type="submit" value="Reply"></form></td></table>HERE;exit;}$general = $_GET['board'];if ($general == general){echo "<h2>General Board</h2>";printboards();exit;} else if ($general == advertise){echo "<h2>Advertising Board</h2>";printboards();exit;} else if ($general == buying){echo "<h2>Buying/Selling Board</h2>";printboards();exit;} else if ($general == art){echo "<h2>Art Board</h2>";printboards();exit;} else if ($general == help){echo "<h2>Help Board</h2>";printboards();exit;} else if ($general == contests){echo "<h2>Contests Board</h2>";printboards();exit;} else if ($general == suggestions){echo "<h2>Suggestions Board</h2>";printboards();exit;}//*Chat list*//print<<<HERE<h1>The Boards</h1><table bgcolor="49614A" cellspacing=7><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=general"><b>General</b></a><br>Talk about anything here XD</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=advertise"><b>Advertise</b></a><br>Here is where you can advertise your dogs, shops, etc.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=buying"><b>buying/selling</b></a><br>Sell and buy things here.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=art"><b>Art</b></a><br>Show off your art here.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=help"><b>help</b></a><br>Need help? Get your answers here.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=contests"><b>Contests</b></a><br>Hold a contest here.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=suggestions"><b>Suggestions</b></a><br>Have a good suggestion for the site? Share it here.</td>HERE;//*Define function*//function printboards(){//*Queries*//$sql = "SELECT * FROM forum WHERE category='$_GET[board]' ORDER BY time DESC";$result = mysql_query($sql);$forum = mysql_fetch_array($result);//*Print out forum*//print<<<HERE<a href="post.php?board=$_GET[board]">New Topic</a><p><br><table width="90%" bgcolor='49614A'><tr bgcolor='49614A' align="center"><th><b>Subject</b></th><th><b>Posts</b></th><th><b>Starter</b></th><th><b>Time</b></th><tr bgcolor='788D7A' align="center">HERE;while ($forum = mysql_fetch_array($result)){$sql1 = "SELECT playerID, username FROM players WHERE playerID='$forum[posterID]'";$result1 = mysql_query($sql1);$player = mysql_fetch_array($result1); echo "<td><a href='boards.php?board=$_GET[board]&topicID=$forum[topicID]'>$forum[subject]</a></td>"; echo "<td>$forum[posts]</td>"; echo "<td><a href='viewprofile.php?profileid=$player[playerID]'>$player[username]</a></td>"; echo "<td>$forum[time]</td>"; echo "<tr bgcolor='788D7A' align='center'>";}print<<<HERE</table>HERE;}?>[/code]This is where all the posts are listed, and it also allows the user to choose which board they would like to enter. If you would like to see the output to the scripts <a href="http://northlakestables.com/dog/">CLICK HERE</a>. If you would not like to join, just login with 'guest' as the login and password.Then just click on the link called 'Boards'...and it will take you to boards.phpEDIT: Oops, I forgot my database info.<u>TABLE 'forum'</u>topicIDposterIDsubjectbodycategorypoststime<u>TABLE 'replies'</u>replyIDtopicIDposterIDbodytime[/quote]This is my problem now. Quote Link to comment Share on other sites More sharing options...
Barand Posted August 20, 2006 Share Posted August 20, 2006 Instead of a query to find the replies then a separate query for each reply to get the username why don't you have a single joined query and one simple loop? Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 20, 2006 Share Posted August 20, 2006 the password and login did not work.how did you enter the time please was it a timestamp.exampletime(); Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted August 20, 2006 Author Share Posted August 20, 2006 I entered the time with:NOW()Barand - I don't understand how I would do that. Would you mind showing me? Quote Link to comment Share on other sites More sharing options...
Barand Posted August 20, 2006 Share Posted August 20, 2006 [code]<?php$sql4 = "SELECT r.topicID, r.posterID, r.body, p.username FROM replies r INNER JOIN players p ON r.posterID = p.playerID WHERE r.topicID='$topic'";$result4 = mysql_query($sql4);?>[/code] Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted August 21, 2006 Author Share Posted August 21, 2006 Thanks Barand XD The problem is still there though...Here is the new code.[code]<?include 'header.php';//*Check if they submited a reply then add it to the database if submited correctly*//if ($_POST['reply']){$topic1 = $_GET['topicID'];$reply_body = trim(addslashes($_POST['reply_body']));if ($reply_body == ""){ echo "You must fill out all fields!";} else {mysql_query("UPDATE `forum` SET `posts` = posts+1, time=NOW() WHERE `topicID` ='$_GET[topicID]' LIMIT 1 ;")or die("Cannot update! " . mysql_error());echo "<table width='80%' bgcolor='49614A'><td align='center' bgcolor='788D7A'><b>Successfully replied!</b></td></table><p>";mysql_query("INSERT INTO replies (topicID, posterID, body, time) VALUES ('$topic1','$sid', '$reply_body', NOW() )") or die(mysql_error()); }}//*If they want to read the post*//$topic = $_GET['topicID'];if ($topic){$sql2 = "SELECT posterID, topicID, subject, body FROM forum WHERE topicID='$topic'";$result2 = mysql_query($sql2);$forum1 = mysql_fetch_array($result2);$sql4 = "SELECT r.topicID, r.posterID, r.body, p.username FROM replies r INNER JOIN players p ON r.posterID = p.playerID WHERE r.topicID='$topic'";$result4 = mysql_query($sql4);$sql1 = "SELECT playerID, username FROM players WHERE playerID='$forum1[posterID]'";$result1 = mysql_query($sql1);$player = mysql_fetch_array($result1);print<<<HERE<a href="http://northlakestables.com/dog/boards.php?board=$_GET[board]">Go back to board</a><p><table width="90%" bgcolor="49614A"><tr bgcolor="607062"><td><b>Subject:</b> $forum1[subject]</td><tr bgcolor="607062"><td align="center"><br><p align="left"><b>Posted By:</b> <a href="viewprofile.php?profileid=$player[playerID]">$player[username]</a></p>$forum1[body]</td>HERE;while ($reply4 = mysql_fetch_array($result4)){$sql6 = "SELECT playerID, username FROM players WHERE playerID='$reply4[posterID]'";$result6 = mysql_query($sql6);$player1 = mysql_fetch_array($result6); echo '<tr bgcolor="788D7A">'; echo "<td align='center'><p align='left'><b>Posted By: </b><a href='viewprofile.php?profileid=$player1[playerID]'>$player1[username]</a></p>"; echo "$reply4[body]</td><tr>";}print<<<HERE<tr bgcolor="788D7A"><td align="center"><form action="boards.php?action=reply&board=$_GET[board]&topicID=$topic" method="POST"><h3>Add a reply</h3><textarea rows=10 cols=50 name="reply_body"></textarea><p><input name="reply" type="submit" value="Reply"></form></td></table>HERE;exit;}$general = $_GET['board'];if ($general == general){echo "<h2>General Board</h2>";printboards();exit;} else if ($general == advertise){echo "<h2>Advertising Board</h2>";printboards();exit;} else if ($general == buying){echo "<h2>Buying/Selling Board</h2>";printboards();exit;} else if ($general == art){echo "<h2>Art Board</h2>";printboards();exit;} else if ($general == help){echo "<h2>Help Board</h2>";printboards();exit;} else if ($general == contests){echo "<h2>Contests Board</h2>";printboards();exit;} else if ($general == suggestions){echo "<h2>Suggestions Board</h2>";printboards();exit;}//*Chat list*//print<<<HERE<h1>Boards do not work perfectly yet!</h1><br><h1>The Boards</h1><table bgcolor="49614A" cellspacing=7><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=general"><b>General</b></a><br>Talk about anything here XD</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=advertise"><b>Advertise</b></a><br>Here is where you can advertise your dogs, shops, etc.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=buying"><b>buying/selling</b></a><br>Sell and buy things here.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=art"><b>Art</b></a><br>Show off your art here.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=help"><b>help</b></a><br>Need help? Get your answers here.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=contests"><b>Contests</b></a><br>Hold a contest here.</td><tr bgcolor="788D7A" align="center"><td><a href="boards.php?board=suggestions"><b>Suggestions</b></a><br>Have a good suggestion for the site? Share it here.</td>HERE;//*Define function*//function printboards(){//*Queries*//$sql = "SELECT * FROM forum WHERE category='$_GET[board]' ORDER BY time DESC";$result = mysql_query($sql);$forum = mysql_fetch_array($result);//*Print out forum*//print<<<HERE<a href="post.php?board=$_GET[board]">New Topic</a><p><br><table width="90%" bgcolor='49614A'><tr bgcolor='49614A' align="center"><th><b>Subject</b></th><th><b>Posts</b></th><th><b>Starter</b></th><th><b>Time</b></th><tr bgcolor='788D7A' align="center">HERE;while ($forum = mysql_fetch_array($result)){$sql1 = "SELECT playerID, username FROM players WHERE playerID='$forum[posterID]'";$result1 = mysql_query($sql1);$player = mysql_fetch_array($result1); echo "<td><a href='boards.php?board=$_GET[board]&topicID=$forum[topicID]'>$forum[subject]</a></td>"; echo "<td>$forum[posts]</td>"; echo "<td><a href='viewprofile.php?profileid=$player[playerID]'>$player[username]</a></td>"; echo "<td>$forum[time]</td>"; echo "<tr bgcolor='788D7A' align='center'>";}print<<<HERE</table>HERE;}?>[/code] Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted August 21, 2006 Author Share Posted August 21, 2006 bump Quote Link to comment Share on other sites More sharing options...
desithugg Posted August 21, 2006 Share Posted August 21, 2006 <? $ord=date("U")-0; ?>and make a new row called ord in your mysql table enter the variable $ord each time a new thread is posted or when a reply is added update that row and used order by ord descthats what i use on my forums and works perfect :) hope this helps Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted August 21, 2006 Author Share Posted August 21, 2006 I think I am going to make a new post tomorrow, because I am confusing people. I already had the first question answered, then I asked another one somewhere on the first page...I don't think everyone is reading it. Quote Link to comment Share on other sites More sharing options...
desithugg Posted August 21, 2006 Share Posted August 21, 2006 i g2g il read it tomarrow lol sorry. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.