Recent Posts

This Post Has Been Viewed 751 Times.

Append data to a text file using php

Posted by admin | Posted in PHP, scripts | Posted on 07-05-2009

0

A simple code that shows how to append data to a flat text file using php

<?php
$File = “myfile.txt”;
$Handle = fopen($File, ‘a’);
$Data = “php\n”;
fwrite($Handle, $Data);
$Data = “mysql\n”;
fwrite($Handle, $Data);
print “Data Added”;
fclose($Handle);
?>

This should add these two names to the end of the file, so our file now contains four names:
php
mysql

VN:F [1.5.7_846]
Rating: 0.0/10 (0 votes cast)
VN:F [1.5.7_846]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • Xerpi

Related posts:

  1. Appending string using php to a text file
  2. Store Data In Remote DataBase Using cUrl or Execute a HTTP POST Using PHP CURL
  3. Write data to a page using javascript

Write a comment

Spam Protected