DataGrid import
| From: | Lars Olesen | Date: | Tue, 23 Jan 2007 17:29:45 +0000 |
| Subject: | DataGrid import | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-26397@lists.php.net to get a copy of this message | ||
Hi,
I was wondering if it is possible to use the DataGrid to import data
into for instance a db using MDB2?
Suppose I have the following code:
require 'Structures/DataGrid.php';
require 'Structures/DataGrid/DataSource/CSV.php';
$options = array(
'delimiter' => ';',
'header' => true
);
$dg = & new Structures_Datagrid();
$dg->bind($csv_file, $options, 'CSV');
Then off course I can render the file using a render.
$dg->render('Console');
But what I want to do is save the data somehow. Lets say I have the
following file:
"Date";"Description";"Amount";"Saldo"
"22-01-2007";"Some text";"-220,00";"135,73"
"10-01-2007";"Some other text";"-45,00";"355,73"
Then I want to be able to save the info afterwards - not just display
it using a render:
1) Choose which fields goes into what spot (for instance an array)
2) Save it in a database (using MDB2).
--
Lars Olesen
Gratis backup https://mozy.com/?code=9MYJPF