Hi. I am in need of some help.
I am making a forum for a project for my school, I have had a lot of bumps in the road but its just about finished, my last problem is this. When ever I create a new thread on the forum, it adds the new thread to the bottom of the page instead of adding it to the top, below is my queries
$select_forum_thread2 = "select * from `forum_threads` where `categorie_id` = '" .$_GET['categorie']. "' LIMIT ".$offset." , ".$rowsPerPage."";
And here is the function for added the new thread to the database.
<?php
if (isset($_POST['add'])) {
$code = $_POST['code'];
$theicon = $_POST['posticon'];
$title = invoer($_POST['title']);
$contents = invoer($_POST['contents']);
$ip = $_SERVER[REMOTE_ADDR];
$username = $memb->username;
$year = date('Y');
$month = date('M');
$day = date('d');
$date = $year. "-" .$month. "-" .$day;
if ($contents == "" OR $code == "" OR $title == "") {
echo"Please fill in all the fields!<br>";$error=1;
}
if ($_POST['code'] != $_SESSION['image_random_value']) {
echo"Please fill in the right security code<br>";$error=1;
}
if ($error != 1) {
$reg_invoer = "INSERT INTO `forum_threads` (`categorie_id` , `owner` , `title` , `text` , `date` , `ip` , `icon`) VALUES ('$categorie_id' , '$username' , '$title' , '$contents' , '$date' , '$ip' , '$theicon');";
mysql_query($reg_invoer);
?>
I just don't know why I can't get it to display new threads at the top of the page, it always goes to the bottom, I've tried to use ORDER BY but I failed. If anyone can fix it or give me help I would be greatly thankful