Results 1 to 8 of 8

Thread: PHP Help

  1. #1
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    1,290

    Latest Awards:

    Default PHP Help

    I have a flatfile system that inserts things into a flatfile like:

    [BEGIN]
    Someones Text
    [END]

    Exactly like that.
    How can I make it so it shows me at the top of the page the most eneterd text (top 5)

    Thanks

  2. #2
    Join Date
    Oct 2007
    Location
    Luton, England
    Posts
    1,548
    Tokens
    388
    Habbo
    DeejayMachoo

    Latest Awards:

    Default

    I think this is what you mean...
    Code:
    <?php
    
    $line=file("http://www.runescape.com/title.ws");
    $snum=0;
    
    $enum=0;
    $s = 'www.runescape.com/img/title2/recent_news.gif" alt="Recent News"></dt>';
    
    $e = '<img class="narrowscroll-bottom" src="http://www.runescape.com/img/scroll/scroll457_bottom.gif" alt="" width="466" height="50">';
    
    
    
    for($i=0;$i<count($line);$i++) {
          
        if(strstr($line[$i],$s)) {$snum=$i;}
        
        if(strstr($line[$i],$e)) {$enum=$i;}
    }
    
    for($i=$snum;$i<$enum;$i++) {
        
          
          
          echo $line[$i];
    }
    ?>
    Thats an example for runescape news.. s = start line
    e = end line
    simple and just change the url at the top

  3. #3
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    1,290

    Latest Awards:


  4. #4
    Join Date
    Oct 2007
    Location
    Luton, England
    Posts
    1,548
    Tokens
    388
    Habbo
    DeejayMachoo

    Latest Awards:

    Default

    whats the page you want to use and what part of it do u want?

  5. #5
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    1,290

    Latest Awards:

    Default

    Cant show the page. Basically people are entering text like "Orange & Green" and it sends to a flatfile page where it is set out like:

    [BEGIN TEXT]
    John voted for Orange & Green
    [END TEXT]

    I want to display at the top of the page like:

    The top 5 votes are
    1. Orange & Green
    2. Pink & Blue

    etcetc

  6. #6
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Can't you use MySQL?

  7. #7
    Join Date
    Oct 2007
    Location
    Luton, England
    Posts
    1,548
    Tokens
    388
    Habbo
    DeejayMachoo

    Latest Awards:

    Default

    twas what i was thinking, i dont have much exprence with flatfiles i know that you have to split each entry up with | OR something so they can be split with the php

  8. #8
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    MySQL would just be much easier

Posting Permissions

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