Hello
I am trying to write a load script that logs into an ftp, downloads a file, then I have the below code which takes that file and does a load data query and is suppose to load it into my database.
I ave had people check my code and they say it looks right, so I have asked my hosting company to check the permissions and they keep asking am I sure the script is coded correct.
They confirm the u/p is correct . So can someone look at the code and let me know if there is anything I can code differently
<?php
//Clear load new file into Staging Database - PE_Tigerdirect
$db_name ="bigvalue";
$connection = mysql_connect(localhost,username,password) or die("Couldn't Connect to Bigvaluezone Database");
$db = @mysql_select_db($db_name, $connection) or die("Couldnt select database.");
$query_b = "LOAD DATA LOCAL INFILE '/home/bigvalue/public_html/price_engine/loader/tigerdirect/tigerdirect.csv' INTO TABLE PE_Tigerdirect FIELDS TERMINATED BY ',' ENCLOSED BY '\"' IGNORE 1 LINES";
$result_b = mysql_query($query_b);
echo mysql_error () ;
$rows_b = mysql_affected_rows()
or die("-PROCESS FAILED error getting row count from Staging Database - PE_Tigerdirect<BR>");
// Error
if ($rows_b == -1) {
print "-PROCESS FAILED error loading tigerdirect into Staging Database - PE_Tigerdirect<BR>";
die;
} else {
print "-Records loaded into Staging Database - PE_Tigerdirect<BR>";
}
?>