Login   Register  
PHP Classes
elePHPant
Icontem

insert data

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

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

  1. insert data   Reply   Report abuse  
Picture of Ion Foso
Ion Foso
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 Ion Foso
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.