Results 1 to 9 of 9

Thread: I need some PHP help

  1. #1
    Join Date
    Dec 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I need some PHP help

    Ok, I am looking to display popular forum threads on the main page of my website, I don't really know anything about php so if anybody has an easy way of doing this that would be great.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    A few questions.

    1) Do you want to display the most popular (ie: most viewed), or the newest ones?

    2) Does your forum use a database or does it use a flat file format (text files to store data)?

    3) What forum do you use (PHPBB, IPB, FlexxBB, etc)?

    If you want to view the most popular (depending on the forum you use) and it uses a database, you should simply be able to display the ones with the most views. To get started you could use the following (assuming you use MySQL):

    test.php
    PHP Code:
    <?php
    //change the following
    $server "localhost"//the database server
    $username "testing"//the database username
    $password "testing"//the database password
    $db "forum"//the forum database


    $conn mysql_connect($server$username$password); //makes the connection

    mysql_select_db($db); // selectes the database

    $threads mysql_query("SELECT * FROM `threads` ORDER BY `views` DESC LIMIT 0, 10"); 

    /* gets the list of threads with the most views starting with the most views and only show 10 */

    echo '<ul>';

    while (
    $q mysql_fetch_array($threads)) { /* assigns a variable for the mysql array */

    echo '<li><a href="threaddisplay.php?id='.$q[id].'">'.$q[title].'</a></li>
    '
    //display the thread title and url to the thread

    }

    echo 
    '</ul>'//end the list.
    ?>
    Hope this helps you get started.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Nov 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    most likely there is a mod for your forum already out there.

  4. #4
    Join Date
    Nov 2006
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by chovy View Post
    most likely there is a mod for your forum already out there.
    Yes, most forum softwares have some sort of MOD/hack called a "portal" that simply shows the latest/most viewed those should be easily modified to fit your needs.

  5. #5
    Join Date
    Dec 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am using phpbb and its on a free server, as a matter of fact I don't even know if I can transfer the forum... anybody know anything about this?
    http://www.hostingphpbb.com/

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Well, you'd need access to the database and move that info to a new server. If you have it, then it's possible. If not, then it's not. Just that simple.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Dec 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well, it looks like the answer is no then doesn't it...:|

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You could try to go in and get access through the Admin CP. I really have no idea about their security/TOS, so not sure.

    Aside from that, I did the same thing....just start over, and do it asap, so you lose the least possible.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #9
    Join Date
    Nov 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You have to have access for the forum to work. Even if you can't directly log in, you could still write a script to export the tables.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •