Maybe it will help if I show you the complete code. Here’s how I have the code. I keep getting the same results with the echo. I’ve tried different locations for the echo.
<?php
$ftp_server = "datafeeds.shareasale.com"; // Do not change this
$ftp_user_name = "name"; // Replace user_name with your SAS login name
$ftp_user_pass = "pass"; // Replace user_pass with your SAS password
$source_file = "/4742/4742.txt"; // Replace both number with the merchant ID
$destination_file = "4742.txt";
$sasid = "anumber"; // REPLACE sas_id with your SAS ID; Can be found at the top of any SAS page
$maintable = "naturehills";
$to_error = "email@hotmail.com";
$subj_error = "ERROR In Naturehills Feed";
$mssg_error = "Database ERROR: ". mysql_error()."\
\
";
$hdrs_error = "From: [email]email@hotmail.com[/email]\
";
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if ((!$conn_id) || (!$login_result)) {
echo "<span style=\\"color:red\\"><center>ERROR: FTP connection has failed to $ftp_server as $ftp_user_name.</center></span>";
exit;
} else {
echo "<span style=\\"color:green\\"><center><br /><br />SUCCESS: $ftp_user_name connected to $ftp_server successfully.</center></span>";
}
$download = ftp_get($conn_id, $destination_file, $source_file, FTP_ASCII);
if (!$download) {
echo "FTP download has failed!";
} else {
echo "<span style=\\"color:green\\"><center>SUCCESS: Downloaded $source_file from $ftp_server as $destination_file</center></span>";
}
ftp_close($conn_id);
/* Include Configuration File */
require_once("config.php");
$FeedFile = $destination_file;
$feed = fopen($FeedFile, 'r');
$rowNum = 0;
while($data = fgetcsv($feed, 50000, "|")){
$ProductID = addslashes($data[0]);
$Name = $data[1];
$Name = preg_replace("/[^a-zA-Z0-9s]/", " ", $Name);
$Name = preg_replace("/\\s+/", " ", $Name);
$Name = ucwords(strtolower($Name));
$MerchantID = addslashes($data[2]);
$Merchant = addslashes($data[3]);
$Link = addslashes($data[4]);
$Thumbnail = addslashes($data[5]);
$BigImage = addslashes($data[6]);
$Price = addslashes($data[7]);
$RetailPrice = addslashes($data[8]);
$Category = addslashes($data[9]);
$SubCategory = addslashes($data[10]);
$Description = addslashes($data[11]);
$Custom1 = addslashes($data[12]);
$Custom2 = addslashes($data[13]);
$Custom3 = addslashes($data[14]);
$LastUpdated = addslashes($data[17]);
$status = addslashes($data[18]);
$sql = mysql_query("INSERT INTO $maintable (ProductID, Name, MerchantID, Merchant, Link, Thumbnail, BigImage, Price, RetailPrice, Category, SubCategory, Description, Custom1, Custom2, Custom3, LastUpdated, status) VALUES ({$ProductID}, {$Name}, {$MerchantID}, {$Link}, {$Thumbnail}, {$BigImage}, {$Price} {$RetailPrice}, {$Category}, {$title}, {$SubCategory}, {$Description}, {$Custom1}, {$Custom2}, {$Custom3}, {$LastUpdated}, {$status}) ON DUPLICATE KEY UPDATE ProductID={$ProductID}, Name={$Name}, MerchantID={$MerchantID}, Merchant={$Merchant}, Link={$Link}, Thumbnail={$Thumbnail}, BigImage={$BigImage}, RetailPrice={$RetailPrice}, Category={$Category}, SubCategory={$SubCategory}, Description={$Description}, Custom1={$Custom1}, Custom2={$Custom2}, Custom3={$Custom3}, LastUpdate={$LastUpdate}, status={$status}");
echo "\
SQL Statement = $sqlstring <br>";
$sql = mysql_query($sqlstring);
$rowNum++;
}
echo "\
SQL Statement = $sqlstring <br>";
$sql = mysql_query($sqlstring);
fclose($feed);
?>