How to list top 20 new post in a forum

Discussion in 'PHP' started by tldmic, Mar 18, 2010.

  1. #1
    hi guys,

    i have a bid of a trouble here, I have made a script to list the post posted by my friends on my site, but the problem is that, all the time I send the new post, it puts it at the bottom, can anyone tell me what am I doing wrong?, am new in this php business,

    thanks
    tldmic

    <?php

    include "include/constants.php"; //mysql db connection here

    echo "<link rel='stylesheet' href='style.css' type='text/css'>";
    echo "


    <div class='newTopic'><a href='post.php?user=$session->userid'>
    <span class='addTopic'>Add New Topic</a></span></a>
    </div>";
    echo "<table class='maintable' cellspacing=0 >";

    echo "<tr class='headline'>

    <td width=40%>Topic</td>
    <td width=20%>Topic Starter</td><td>Replies</td><td>Last replied time</td></tr>";

    $getthreads="SELECT * from forum where parentid='0' order by lastrepliedto DESC limit 0,24";

    $getthreads2=mysql_query($getthreads) or die("Could not get threads");

    while($getthreads3=mysql_fetch_array($getthreads2))

    {

    $getthreads3[title]=strip_tags($getthreads3[title]);

    $getthreads3[author]=strip_tags($getthreads3[author]);

    echo "<tr class='mainrow'>
    <td><A href='message.php?id=$getthreads3[postid]'>$getthreads3[title]</a></td>
    <td>$getthreads3[author]</td>
    <td>$getthreads3[numreplies]</td>
    <td>$getthreads3[showtime]<br>Last post by <b>$getthreads3[lastposter]</b></td>
    </tr>";

    }

    echo "</table>";



    ?>
     
    tldmic, Mar 18, 2010 IP
  2. SolomonZhang

    SolomonZhang Peon

    Messages:
    523
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It may not the problem at the php. It might be at the css. If your table is set to float, it may be put somewhere else ( e.g. pushed down) rather than being displayed as it is.
     
    SolomonZhang, Mar 18, 2010 IP
  3. tldmic

    tldmic Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes in my style.css i have :

    userforum {
    background :.....;
    float:left;
    width:X%;
    height:Ypx;

    }


    can you please advice further;
    many thanks
     
    tldmic, Mar 18, 2010 IP