writing to txt-file! if and else!
| From: | Fredrik Arild Takle | Date: | Wed, 12 Jul 2000 10:32:44 +0000 |
| Subject: | writing to txt-file! if and else! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-6111@lists.php.net to get a copy of this message | ||
Need some help!
Hi there I'm currently making a php page that writes to a txt file... I have books and
bookloaners in the txt-file!
If the book don't exist i want a <br> and bookno user
like this:
1 55555
elseif it does exist i want to place the user(name) at the end, in que!
Here is my source:
<?
$filnavn = "liste.txt";
$fpr = fopen($filnavn, "r");
while($innhold = fgets($fpr, 4096)) {
$do_explode = explode(" ", $innhold);
if ($do_explode[0] <> $no) {
$count = count($do_explode) - 1;
for ($i = 1; $i <= $count; $i++)
echo "Book already exists ($count in que!)";
\\add to end of line here
}
if ($do_explode[0] == $no) {
$filnavn = "liste.txt";
$fpr = fopen($filnavn, "a+");
\\new entry here
// fclose($fpr);
fwrite ($fpr, "\n$no $empl_nr");
// fclose($fpr)
} }
?>
Best Regards
Fredrik A. Takle
ftakle@online.no