Hi everybody,
I have some big csv-like files with 15.000 and more artikles stored in it.
They should be put into a mysql database.
I thought about PHP processing
but only the read and print of these lines using the read_csv() function as
in the attached script has a more-minutes execution time.
What would be the better solution.. a Visual Basic written import tool that
uses ODCB or a PHP using one?
How can I optimize the import or get the readout faster?
Greets T_Crusher
_______________ _______________ _______
PHP
function read_csv($filen ame, $delim=',')
{
$row = 0;
$dump = array();
$f = fopen ($filename,"r") ;
$size = filesize($filen ame)+1;
while ($data = fgetcsv($f, $size, $delim)) {
$dump[$row] = $data;
$row++;
}
fclose ($f);
return $dump;
}
set_time_limit( 0);
$files = read_csv("kaufh of.csv", ";");
$text = array ("<hr><br><br>n ummer: ",
"<br>Artike l: ",
"<br>Beschreibu ng: ",
"<br>Größe: ",
"<br>Form: ",
"<br>Nummer : ",
"<br>Hersteller : ",
"<br>Nummer 2: ",
"<br>Farbe: ",
"<br>Nummer 3: ",
"<br>Preis: ",
"<br>Thumb: ",
"<br>Link: ");
for ($x=0; $x<count($files ); $x++)
{
if ($brand="kaufho f")
{
array_shift($fi les);
}
for ($z=0; $z<count($files[$x]); $z++)
{
print ($text[$z].$files[$x][$z]."<br><br>\n ");
}
}
--
_______________ _______________ _______________ _
Michel Feldheim
michael@feldhei m-web.de
I have some big csv-like files with 15.000 and more artikles stored in it.
They should be put into a mysql database.
I thought about PHP processing
but only the read and print of these lines using the read_csv() function as
in the attached script has a more-minutes execution time.
What would be the better solution.. a Visual Basic written import tool that
uses ODCB or a PHP using one?
How can I optimize the import or get the readout faster?
Greets T_Crusher
_______________ _______________ _______
PHP
function read_csv($filen ame, $delim=',')
{
$row = 0;
$dump = array();
$f = fopen ($filename,"r") ;
$size = filesize($filen ame)+1;
while ($data = fgetcsv($f, $size, $delim)) {
$dump[$row] = $data;
$row++;
}
fclose ($f);
return $dump;
}
set_time_limit( 0);
$files = read_csv("kaufh of.csv", ";");
$text = array ("<hr><br><br>n ummer: ",
"<br>Artike l: ",
"<br>Beschreibu ng: ",
"<br>Größe: ",
"<br>Form: ",
"<br>Nummer : ",
"<br>Hersteller : ",
"<br>Nummer 2: ",
"<br>Farbe: ",
"<br>Nummer 3: ",
"<br>Preis: ",
"<br>Thumb: ",
"<br>Link: ");
for ($x=0; $x<count($files ); $x++)
{
if ($brand="kaufho f")
{
array_shift($fi les);
}
for ($z=0; $z<count($files[$x]); $z++)
{
print ($text[$z].$files[$x][$z]."<br><br>\n ");
}
}
--
_______________ _______________ _______________ _
Michel Feldheim
michael@feldhei m-web.de
Comment