PHP Classes

insert data

Recommend this page to a friend!

      CSV Handler  >  All threads  >  insert data  >  (Un) Subscribe thread alerts  
Subject:insert data
Summary:insert data in csv
Messages:2
Author:Gheorghe Sarbu
Date:2011-03-17 11:20:45
Update:2011-03-21 08:02:55
 

  1. insert data   Reply   Report abuse  
Picture of Gheorghe Sarbu Gheorghe Sarbu - 2011-03-17 11:20:45
Hello Sir !

I have a csv file like this:

record; english; danish
1; luggage;
2; lobby;
3; stationery;

In the field 'danish' I want to insert the translate of the field 'english'.
I will use Google Translate API for translate the text, but I don't know how to insert, so please help me.


Thank you very much in advance


  2. Re: insert data   Reply   Report abuse  
Picture of Andreas Mueller Andreas Mueller - 2011-03-21 08:02:55 - In reply to message 1 from Gheorghe Sarbu
Hi Ion!

the update function does this:

Update($key,$data) { //Updating Item "key" with "data" named array
will change contnent of any field you specify.

With your sample data:

record; english; danish
1; luggage;
2; lobby;
3; stationery;

to put 'Bøjning' into danish Number 2 you that would be something like:

$data = new CSVHandler("wordfile.csv",";","record");
$newData=array('danish' => 'Bøjningo');
$data->update(2,$newData);


Hope this helps.