Web Design and Web Development Forum

  1. #1
    Join Date
    Nov 2007
    Posts
    12
    Rep Power
    0
  2. syncbyte is on a distinguished road
  3. forum last topic..

    hi guyz..

    how can i make phpbb forum last topic?? or smf last topic?
    i tried to make but its not working..:/

    thx
    Reply With Quote Reply With Quote
  4. #2
    gorda001's Avatar
    Join Date
    Jun 2005
    Location
    <0x79a3f6>
    Posts
    4,851
    Rep Power
    11
  5. gorda001 is on a distinguished road
  6. Re: forum last topic..

    I don't really understand. You want to create a new topic in phpbb/smf? Or do you want to get the name of the last topic?
    Reply With Quote Reply With Quote
  7. #3
    Damien Gray's Avatar
    Join Date
    Jul 2008
    Location
    New York
    Age
    20
    Posts
    415
    Rep Power
    4
  8. Damien Gray is on a distinguished road
  9. Re: forum last topic..

    I think he means he wants to create a link to the last topic posted.

    This is what I'd do (someone always has a better answer than me >_>)
    PHP Code:
    $sql "SELECT * FROM `topics` ORDER BY `id` DESC, LIMIT 1";
    $result mysql_query($sql);
    $row mysql_fetch_assoc($result);

    echo 
    '<a href="topic.php?id="'$row['id'] .'">'.$row['topic_title'].'</a>'
    Untested, but with the right field names, it should work.
    Quote myself originally posted:
    I'm not sure what I should be more concerned with...the fact that the pen I'm chewing on tastes like mustard, or that I found the pen on my floor.
    Reply With Quote Reply With Quote
  10. #4
    Join Date
    Sep 2005
    Location
    UK
    Age
    27
    Posts
    807
    Rep Power
    0
  11. bfsog is on a distinguished road
  12. Re: forum last topic..

    While your code looks good to go Damien, there is no point returning all columns (*) when you only need two of them. Replace the * with id and topic_title (or whatever the correct column names are).

    Edit: And also be sure to check the $result returns some data (at least 1 row).
    Reply With Quote Reply With Quote
  13. #5
    gorda001's Avatar
    Join Date
    Jun 2005
    Location
    <0x79a3f6>
    Posts
    4,851
    Rep Power
    11
  14. gorda001 is on a distinguished road
  15. Re: forum last topic..

    Also you should be doing htmlspecialchars on topic_title.
    Reply With Quote Reply With Quote

Similar Threads

  1. Web forum design: a dissection of common mistakes and possible improvements
    By Mike Tomasello in forum General Web Programming
    Replies: 23
    Last Post: 03-29-2008, 06:06 AM
  2. WebHosting Forum
    By darkecho in forum Web Hosting Help
    Replies: 12
    Last Post: 10-05-2005, 09:15 PM