#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Aurora, CO USA
    Posts
    4
    Rep Power
    0
    I am using a tab delimited file to provide information for a page to be displayed. I have used fgetcsv() to get information from the file, and it returns an array of information. I was wondering if there is a way I could change information in the file. For example lets say that $content[2] = "This" how could I change it so that, $content[2] = "That". I know how to change the variable to a different value, but I haven't figured out how to change the actual file. Any ideas?

    TIA
  2. #2
  3. No Profile Picture
    Carpe Diem
    Guest
    Devshed Newbie (0 - 499 posts)
    read it change the array values and then write it back again



    ------------------

    Regards
    Darren
    --
    http://www.php4hosting.com/ $
    http://www.php4hosting.co.uk/
    PHP/MySQL Enabled Hosting/Dedicated Servers
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Aurora, CO USA
    Posts
    4
    Rep Power
    0
    here's the code I'm using to write to the file, I have gotten it to write to the file, but I want it to replace the contents of the file, not just append to it.

    for($i=0; $i<=15; $i++)
    {
    fputs($sale_data, "$change[$i]n");
    }
    $data_stuff = file("bio_data.data");
    for($z=0; $z<=15; $z++)
    {
    print("<Font Face="Arial" Size="-2">$data_stuff[$z]</Font><BR>n");
    }
    fclose($sale_data);
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Aurora, CO USA
    Posts
    4
    Rep Power
    0
    and it is writting to the file, except it is adding blank lines in wierd places, and it doesn't seem to be making any changes at all to the items that I wanted changes done to.

    Any ideas are greatly appreciated.

    [This message has been edited by mikeyt_333 (edited October 12, 2000).]

Similar Threads

  1. Pointer problem in opening a file
    By LAKI in forum C Programming
    Replies: 13
    Last Post: February 11th, 2004, 08:27 AM
  2. Pointer problems opening file *formatted*
    By LAKI in forum C Programming
    Replies: 4
    Last Post: February 11th, 2004, 06:06 AM
  3. how to store info in a file ????
    By janujanu in forum PHP Development
    Replies: 2
    Last Post: February 10th, 2004, 01:28 PM
  4. PHP file upload script trouble
    By casbboy in forum PHP Development
    Replies: 9
    Last Post: February 5th, 2004, 07:42 PM
  5. Replies: 3
    Last Post: January 30th, 2004, 03:44 PM

IMN logo majestic logo threadwatch logo seochat tools logo