Is there a way to write to a text file using fopen, beginning at the start of the file and not at the end. Because now I use
fopen("gastenboek.txt","a")
But when I read out the file the records appear the first one last and vice versa.
Another problem is that all the records are printed on the same page. I want to spread over several pages wich are generated automaticly.
Greetz
I read the text file with this code:
<html>
<head>
<title>Read guestbook</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?
$array = file("gastenboek.txt");
foreach($array as $row) {
$line = explode("|", $row);
print "<table width=\"368\" border=\"1\" cellspacing=\"7\" bordercolor=\"#FFFFFF\" align=\"center\">
<tr>
<td width=\"154\" bgcolor=\"#F4F4F4\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">Naam
: </font></b></td>
<td width=\"205\" bgcolor=\"#FFCC00\" bordercolor=\"#000000\"><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">$line[0]</font></td>
</tr>
<tr>
<td width=\"154\" bgcolor=\"#F4F4F4\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">Email
: </font></b></td>
<td width=\"205\" bgcolor=\"#FFCC00\" bordercolor=\"#000000\"><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">$line[1]</font></td>
</tr>
<tr>
<td width=\"154\" bgcolor=\"#F4F4F4\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">Homepage
: </font></b></td>
<td width=\"205\" bgcolor=\"#FFCC00\" bordercolor=\"#000000\"><a href= \"$line%5B2%5D\"><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">$line[2]</font></a></td>
</tr>
<tr>
<td width=\"154\" bgcolor=\"#F4F4F4\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">Comments
: </font></b></td>
<td rowspan=\"2\" bgcolor=\"#FFCC00\" bordercolor=\"#000000\" width=\"205\" valign=\"top\"><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">$line[3]</font></td>
</tr>
<tr>
<td width=\"154\" bgcolor=\"#FFFFFF\" height=\"80\"><b></b></td>
</tr>
<tr bordercolor=\"#FFFFFF\">
<td colspan=\"2\" height=\"8\">
<div align=\"center\">
<hr align=\"center\" noshade>
</div>
</td>
</tr>
</table>
";
}
?>
<font face="Arial, Helvetica, sans-serif" size="2"><br>
</font>
<br>
</body>
</html>