Log in

View Full Version : PHP Help



Robbie
20-10-2007, 11:33 AM
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

DeejayMachoo$
20-10-2007, 11:43 AM
I think this is what you mean...


<?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 :)

Robbie
20-10-2007, 01:06 PM
Doesn't work.

DeejayMachoo$
20-10-2007, 01:26 PM
whats the page you want to use and what part of it do u want?

Robbie
20-10-2007, 01:33 PM
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

Dentafrice,
21-10-2007, 01:57 AM
Can't you use MySQL?

DeejayMachoo$
21-10-2007, 06:46 AM
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

Dentafrice,
21-10-2007, 01:06 PM
MySQL would just be much easier :P

Want to hide these adverts? Register an account for free!