Hi,
I have a textfile with data for a guestbook, like this:
name:messgage goes here:date goes here
name:messgage goes here:date goes here
name:messgage goes here:date goes here
I want to be able to split the data so I can print it in a nice, presentable fashion.
So, I can separate each entry by exploding the contents of the file by \n. So I have an array containing each line of the file. But how can I split the file further into each individual piece of the entry.
I have this so far:
$filename = "/data/data.dat";
$fp = @fopen($filename,r);
$contents = fread ($fp,filesize($filename));
$separate_msgs = explode("\n",$contents);
@fclose($fp);
foreach($separate_msgs as $value) {
echo"<P>$value</P>\n";
}
Any help would be great,
Cheers,
Jord