Re: php sccript to display content on browser
| From: | Marek Kilimajer | Date: | Tue, 22 Apr 2003 11:23:13 +0000 |
| Subject: | Re: php sccript to display content on browser | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144807@lists.php.net to get a copy of this message | ||
open the file and read it line by line until the line contains "</Date:$day/$month/$year>\n", then break the loop and use regular expresions to get the songs:
while($line=fgets($file)){ // $file is the file pointer
if(preg_match('/<([^>])><([^>])><([^>])><([^>])><([^>])>\s*',$line, $m) {
// $m now contains an array with the info
echo "<tr><td>$m[1]</td><td>$m[2]</td><td>$m[3]</td><td>$m[4]</td><td>$m[5]</td></tr>\n";
} else {
// new date, break
break;
}
}
Nitin Ambekar wrote:
hi nicos, could i expect help put php script for following condition. i have a asp script which i have to change to php. there are date function to add date etc but how to use strtotime() of php or is there u suggest any other logic for below task. i have a text file called top10song.txt which has a content in the following format: </Date:16/4/2003> <None><1><jina o tere lie><7><16> <None><2><ishq kamina><6><18> . . . <Date|> <|Date:15/4/2003> <None><1><o hamdam suniyo re><6><7> <None><2><chhalakA-chhalakA re><5><7> . . . <Date|> rqiurement is the page on browser should show supposeDate:2003 April 16 Prev.Rank curr. Rank Song Title Users/Songs none 1 jina o tere liye 7/16 none 2 ishq kamina 6/18. . and if the previous button on browser is pressed it should show the 15th content in the above format. there are buttons named next and previous diplayed on the browser with the table. i have a asp code but i have to change it to php. in anticipation nitin