You are here: why this load data infile doesn't work? « PHP Programming Language « IT news, forums, messages
why this load data infile doesn't work?

Posted by johnny on 02/03/06 13:26

hi all,

I wonder why this little script doesn't work, maybe it's the provider
not allowing the use of load data infile ( I know some don't let users
to run some tasks ), could you please tell me if the script it's right
before I ask the provider ?
I can insert data into the table using fgetcsv as well with no
problems,but I would like to understand.

TIA

johnny

<?php

$table = "name of table here";
$file = "absolute path to file uploaded /" ;
$new_name = "list.csv"; // new name of the file uploaded


$file_name = ($new_name) ? $new_name : $_FILES["upfile"]["name"];


$path = $file.$file_name ;


if (copy($upfile, $path))
{
echo "upload Ok";

} else {
echo "upload failed";
}


$sql = "LOAD DATA INFILE '$path' FIELDS INTO TABLE $table
(field1,field2) TERMINATED BY ';' LINES TERMINATED BY '\r\n' IGNORE 1
LINES " or die();

?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация