I hope some body can help me with this Tank's
Parse error: syntax error, unexpected T_VARIABLE in /xxxxxxxxx/csv/csvtosql.php on line 43
I have mark it with red color
MOD EDIT: Changed to '--- HERE ---'
//enter your database information here
//scroll down to enter column headers
$host='xxxxxxxxx';
$username='xxxxxxxx';
$password='xxxxxxx';
$database='xxxxxxxxx';
$table='products';
$file='test.csv';
// Connect to database
$link=mysql_connect($host, $username, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
if($link){
mysql_select_db($database);
// delete data from table
$del = "DELETE FROM ".$table;
if (mysql_query ($del)) {
echo "records deleted";
}
else {
echo "Error during delete: ". mysql_error ();
}
$start = 1;
$sql_file = fopen($file, "r");
while(feof($sql_file) == 0) {
$line = chop(fgets($sql_file, 24000));
if($line != "") {
$start++;
$text = explode(";", $line);
$fieldnum = count($text);
$insert = "INSERT INTO ".$table
//ENTER COLUMN HEADERS HERE
/* -- HERE -- */ $insert= "(products_id,products_quantity,products_image,products_price,products_date_added,products_last_modified,products_date_available,products_weight,products_status;products_tax_class_id,manufacturers_id,products_ordered)" .
for($i = 0; $i < $fieldnum; $i++) {
$text[$i] = ereg_replace("##", "\r\n", $text[$i]);
$temp=trim($text[$i]);
$insert.="'";
$insert.=$temp;
$insert.="', ";
}
$insert = substr($insert,0,strlen($insert)-2);
$insert.= ")";
mysql_query($insert) or die ("Error: ".mysql_error());
}
}
}
mysql_close($link);
?>