Need help

Someone help me please!

I want to basically… everytime I create a new topic. I want the new topic to be over the old topic (which has already been created before) but whenever I create a new one, it goes below the old one instead of on top of it.

The php coding is…

<?php session_start(); include_once("includes/db_connect.php"); include_once("includes/functions.php"); include_once("includes/smile.php"); logincheck(); $username=$_SESSION['username']; $fetch = mysql_fetch_object(mysql_query("SELECT * FROM `users` WHERE `username` = '$username'")); $re = makesafe($_GET['re']); $forum = makesafe($_GET['forum']); if(!$_GET['forum']){ $forum = $fetch->forum; } if($re){ $target = "right"; }else{ $target = "_self"; } $view = makesafe($_GET['view']); $crew = $fetch->crew; $change = makesafe($_GET['change']); $id = makesafe($_GET['id']); $crew = $fetch->crew; if($_GET['give']){ $give = makesafe($_GET['give']); if($fetch->userlevel == "0"){ echo"You cant give respect, your not staff!"; } elseif($fetch->userlevel == "4" || $fetch->userlevel == "1"){ mysql_query("UPDATE users SET respect=respect+50 WHERE username='$give'"); echo " "; }} if($_GET['take']){ $take = $_GET['take']; if($fetch->userlevel == "0"){ echo"You cant take respect, your not staff!"; } elseif($fetch->userlevel == "4" || $fetch->userlevel == "1"){ mysql_query("UPDATE users SET respect=respect-50 WHERE username='$take'"); echo " "; }} //This is the value that sets how long the user must wait after posting or creating a topic (In Minutes) - 0 for none. define("POSTTIMER", 2.5); ////page//// $query_count = "SELECT * FROM `topics` WHERE forum='$forum'"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); $query="SELECT * FROM `topics` WHERE forum='$forum' ORDER BY `lastreply` DESC LIMIT 68, $totalrows"; $query=mysql_query("$query"); while($fo=mysql_fetch_object($query)){ mysql_query("DELETE FROM topics WHERE id='$fo->id'"); mysql_query("DELETE FROM replys WHERE idto='$fo->id'"); } ////page//// //If you have any other forums other than the ones below please add them... Case sensitive if(!in_array($forum, array('NewsUpdatesNotices', 'Chat', 'PictureProfile', 'Ads', 'OCBJAds', 'HelpBugsSuggestions', 'crew'))){ die; } if($fetch->userlevel == "0"){ if(!$crew && $forum == 'crew'){ die("You Are Not In A Crew."); } } $fetchc=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew' LIMIT 1")); $forumm = 0; if($forum == "crew"){ if(($fetchc->owner == $username) || ($fetchc->underboss == $username) || ($fetchc->lhm == $username) || ($fetchc->rhm == $username)){ $forumm = 1; }} if($fetch->userlevel == "3" || $fetch->userlevel == "4" || $fetch->userlevel == "1"){ $forumm = 1; } if($forum == 'crew' && $crew) { $getTopics = mysql_query("SELECT * FROM `topics` WHERE `forum` = '$forum' AND `crew` = '$crew' ORDER BY `sticky` DESC, `lastreply` DESC"); } else { $getTopics = mysql_query("SELECT * FROM `topics` WHERE `forum` = '$forum' ORDER BY `sticky` DESC, `lastreply` DESC"); } $totalTopics = mysql_num_rows($getTopics); $topics_per_page = 20; $offset = (int)$_GET['fpage'] * $topics_per_page; $pages = ceil($totalTopics / $topics_per_page); for ($i=0;$i<$pages;$i++) { $n = $i+1; if ($_GET['fpage'] == $i) { $page .= "$n "; } else { $page .= "$n "; }} if($forum == 'crew' && $crew) { $getTopics = mysql_query("SELECT * FROM `topics` WHERE `forum` = '$forum' AND `crew` = '$crew' ORDER BY `sticky` DESC, `lastreply` DESC LIMIT $offset, $topics_per_page"); } else { $getTopics = mysql_query("SELECT * FROM `topics` WHERE `forum` = '$forum' ORDER BY `lastreply` DESC LIMIT $offset, $topics_per_page"); } if($forumm == 1){ $topicListOptions = "With Selected: DeleteImportant/UnimportantStick/UnstickLock/UnlockClear "; } if($re){ $createTitle = "New Topic / '$target' class=\"style5\">Set as Default. / '$target' class=\"style5\">Categories"; }else{ $createTitle = "New Topic / Set as Default. / Categories"; $createTitle2 = ""; } if($forumm == 1 && $_POST['checkbox'] != '') { $option = makesafe($_POST['forumOptionsList']); if($option == 'delete') { foreach($_POST['checkbox'] as $id) { mysql_query("DELETE FROM `topics` WHERE `id` = '$id'"); mysql_query("DELETE FROM `replys` WHERE `idto` = '$id'"); mysql_query("DELETE FROM `topic_votes_new` WHERE `idto` = '$id'"); } } elseif($option == 'stickUnstick') { foreach($_POST['checkbox'] as $id) { $fetchStickTopic = mysql_fetch_array(mysql_query("SELECT `sticky` FROM `topics` WHERE `id` = '$id'")); if($fetchStickTopic[sticky] == 1){ mysql_query("UPDATE `topics` SET `sticky` = '0' WHERE `id` = '$id'"); } else{ mysql_query("UPDATE `topics` SET `sticky` = '1' WHERE `id` = '$id'"); } } } elseif($option == 'impUnimp') { foreach($_POST['checkbox'] as $id) { $fetchImpTopic = mysql_fetch_array(mysql_query("SELECT `imp` FROM `topics` WHERE `id` = '$id'")); if($fetchImpTopic[imp] == 1){ mysql_query("UPDATE `topics` SET `imp` = '0' WHERE `id` = '$id'"); } else{ mysql_query("UPDATE `topics` SET `imp` = '1' WHERE `id` = '$id'"); } } } elseif($option == 'lockUnlock') { foreach($_POST['checkbox'] as $id) { $fetchLockTopic = mysql_fetch_array(mysql_query("SELECT `locked` FROM `topics` WHERE `id` = '$id'")); if($fetchLockTopic[locked] == 1){ mysql_query("UPDATE `topics` SET `locked` = '0' WHERE `id` = '$id'"); } else{ mysql_query("UPDATE `topics` SET `locked` = '1' WHERE `id` = '$id'"); } } } elseif($option == 'clearTopic') { foreach($_POST['checkbox'] as $id) { mysql_query("DELETE FROM `replys` WHERE `idto` = '$id'"); } } } ?>

Create New Topic

<?

if ($crew == “0”){

$query=“SELECT * FROM topics WHERE forum=’$forum’ AND crew=’$fetch->crew’ ORDER BY sticky DESC LIMIT $forum_look, $forum_count”;

}else{

$query=“SELECT * FROM topics WHERE forum=’$forum’ ORDER BY sticky DESC LIMIT $forum_look, $forum_count”;

}

$query=mysql_query("$query");

$num=mysql_num_rows($query);

$col=“0”;

while($fo=mysql_fetch_object($query)){

if ($col==“0”){ $td=""; $col=“1”; }else{ $td=""; $col=“0”; }

$hehe=mysql_num_rows(mysql_query(“SELECT * FROM replys WHERE idto=’$fo->id’”));

if ($userlevel > 2 || strtolower($by) == strtolower($username)){

echo "


”;

}elseif ($crew == “1” && $owner != “0”){

echo "


”;

}elseif ($helper > 0 || strtolower($by) == strtolower($username)){

echo "


”;

}else{

echo "


”;

}

echo “

”;

}

if($_GET[boogle]) {

$boogle = $_GET[boogle];

$cc=mysql_num_rows(mysql_query(“SELECT * FROM topics WHERE username=’$username’ AND id=’$boogle’”));

if($userlevel > 0 || $clean != “0” ){

if ($forum == “Crew” && $crew == “1”){

mysql_query(“DELETE FROM topics WHERE id=’$boogle’ AND crew=’$fetch->crew’”);

mysql_query(“DELETE FROM replys WHERE idto=’$boogle’ AND crew=’$fetch->crew’”);

}else{

mysql_query(“DELETE FROM topics WHERE id=’$boogle’”);

mysql_query(“DELETE FROM replys WHERE idto=’$boogle’”);

}

echo “Cleaned”;

echo “”;

}

}

if($_GET[‘important’]){

$viewtopics = $_GET[important];

mysql_query(“UPDATE topics SET imp=‘1’ WHERE id=’$viewtopics’”);

echo “You successfully made this topic important!”; }

if($_GET[‘sticky’]){

$viewtopics = $_GET[sticky];

mysql_query(“UPDATE topics SET sticky=‘1’ WHERE id=’$viewtopics’”);

echo “You successfully made this topic sticky!”; }

if($_GET[‘lock’]){

$viewtopicss = $_GET[lock];

mysql_query(“UPDATE topics SET locked=‘1’ WHERE id=’$viewtopicss’”);

echo"You successfully locked this topic!"; }

?>

Topic
"; if ($fo->imp == “1” ){ echo"Important: "; } if ($fo->sticky == “1” ){ echo"Sticky: "; } echo “$fo->title | DELETE - Imp - Sticky - Lock
"; if ($fo->imp == “1” ){ echo"Important: "; } if ($fo->sticky == “1” ){ echo"Sticky: "; } echo “$fo->title | DELETE - Imp - Sticky - Lock
>"; if ($fo->imp == “1” ){ echo"Important: "; } if ($fo->sticky == “1” ){ echo"Sticky: "; } echo “$fo->title | DELETE - Imp - Sticky - Lock
"; if ($fo->imp == “1” ){ echo"Important: "; } if ($fo->sticky == “1” ){ echo"Sticky: "; } echo “$fo->title $hehe
<?php
index_navigation($forum_look, $forum_count, $num);	

?>

I’d really appreciate if you help me thanks 8)

I think you should just change the query that fetch topics to display, it probably just need an order by fix

Sponsor our Newsletter | Privacy Policy | Terms of Service