Code: Select all
register_globals = on
allow_url_fopen = off
expose_php = Off
max_input_time = 2400
max_execution_time = 2400
upload_max_filesize = 192M
memory_limit = 256M
variables_order = "EGPCS"
extension_dir = ./
upload_tmp_dir = /tmp
precision = 12
SMTP = relay-hosting.secureserver.net
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="Code: Select all
$lineseparator = "\n";
$fieldseparator = ",";
$csvfile = "upload/products_1.csv";
if (!file_exists($csvfile))
{
echo "file not found. Make sure the products_1.csv file is in the upload folder.\n";
exit;
}
$file = fopen($csvfile,"r");
if (!file)
{ echo "error opening data file. \n";
exit;
}
$size = filesize($csvfile);
if (!size) {
echo "file is empty.\n";
exit;
}
$csvcontent = fread($file,$size);
fclose($file);
$lines = 0;
$queries= "";
$linearray = array();
foreach(split($lineseparator,$csvcontent) as $line)
{
$lines++;
$line = trim($line,"\t");
$line = str_replace("\r","", $line);
$linearray = explode($fieldseparator,$line);
$linemysql = implode("','", $linearray);
$query = "insert into prevc_products values ('$linemysql');";
$queries .= $query . "\n";
@mysql_query($query);
http://www.datacaresol.com/phpinfo.php
Thanks for any suggestions with this problem.
Marnie