March 24th, 2003, 09:12 PM
PHP, File reading
Greetz, Im working on a new site and im makeing it with php,
so far I've made a script that inputs the "news" ,
it inputs it into a file called blog.dat
and it looks like this
ok now what I want to do is open the file, read each line im then going to use explode() to serpate it up at each | and store it in an array, and then print out a table for each lineby using while( !feof($fp)) .. but what I've realised is, I dont know any ways in to check for the end of the line, so it would just be one big long, string. I've used \n to go to the next file in blog.dat but I have no way of telling the file to stop when it reachs the end of the line and then to start a new block... so my whole theroy behind how it was going to work is screwed
wispy|today was good|Yer and so I woke up and got kinda annoyed cos i kicked the door........
Belinda|ohh dam|Hey welcome to the brand new site .....
so what I want to do is, read the file, get each line in the file split it up into each section, have a block on the main page for each post, and then stop after 10 lines,
Im not a great programmer, im very new to php and well not very good.. so im reading ebooks makeing scripts and learning from y errors and asking my friends dumb questions any help would be greatly appreciated