Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2000071

[PHP] writing to txt-file! if and else! From: Fredrik Arild Takle (ftakle <email protected>)
Date: 07/12/00

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 <email protected>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>