Ok I have been working on the code for some hours now, and i have to say "IT'S BOTHERING ME A LOT" and I need some help from you php masters out there....
Paste this in the "something.txt"
this space for TOPIC|this space for TEXT|this space for TIME|and this space for File
this space for TOPIC|this space for TEXT|this space for TIME|and this space for File
this space for TOPIC|this space for TEXT|this space for TIME|and this space for File
this space for TOPIC|this space for TEXT|this space for TIME|and this space for File
this space for TOPIC|this space for TEXT|this space for TIME|and this space for File
Ok the code works, but i keep getting the same number on each line.
I don't know whats wrong with the code, so some help from you php-guru would help.
Question
[pioneer]
Ok I have been working on the code for some hours now, and i have to say "IT'S BOTHERING ME A LOT" and I need some help from you php masters out there....
<? $fil = "something.txt"; print "<p><SELECT NAME=\"1\" SIZE=\"21\" MULTIPLE> <OPTION> </OPTION>"; $fp = @fopen($fil, "r") or die("Error"); $indhold = @fread($fp, filesize($fil)); $split = @split( "\n", $indhold); for ($x = count($split)-1; $x > 0; $x--) { while($str = fgets($fp, 1024)) { $linje = @split( "\|", $str); $linje[1] = ereg_replace( "\n", "", $linje[1]); print "<OPTION>$x, $linje[0], $linje[1], $linje[2], $linje[3]</OPTION>\n"; } } print "</SELECT></p>"; ?>Ok the code works, but i keep getting the same number on each line.
I don't know whats wrong with the code, so some help from you php-guru would help.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts