Forum Moderators: coopster
<?
$dbhost = 'localhost';
$dbuser = '#*$!#*$!';
$dbpass = '#*$!#*$!';
$dbname = '#*$!#*$!';
$dblink = 'account_id';
$dblink = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname, $dblink);
$csvfile = "/home/.sites/75/site8/web/chrysler/csv/DCB.csv";
$seperator = ",";
$lines = file($csvfile);
foreach($lines as $line) {
$rows = explode($seperator,$line);
$sql = "UPDATE account_id SET Purchase_Date = 'Purchase_Date' Where Emp_No = 'Emp_No'";
$result = mysql_query($sql, $dblink) or die("load -" . mysql_error());
}
?> foreach($lines as $line) {
$rows = explode($seperator,$line);
$sql = "UPDATE account_id SET Purchase_Date = 'Purchase_Date' Where Emp_No = 'Emp_No'";
$result = mysql_query($sql, $dblink) or die("load -" . mysql_error());
}
foreach($lines as $line) {
$rows = explode($seperator,$line);
echo "<pre>";
print_r($rows);// add this instruction to see what the result is from the array
echo "</pre>";
exit;//terminate the script, no need to run this part yet
$sql = "UPDATE account_id SET Purchase_Date = 'Purchase_Date' Where Emp_No = 'Emp_No'";
$result = mysql_query($sql, $dblink) or die("load -" . mysql_error());
}
foreach($lines as $line) {
$rows = explode($seperator,$line);
echo "<pre>";
print_r($rows);// this enables you to see the data returned from the file in array format
echo "</pre>";
//$sql = "UPDATE account_id SET Purchase_Date = 'Purchase_Date' Where Emp_No = 'Emp_No'";
//$result = mysql_query($sql, $dblink) or die("load -" . mysql_error());
}
$sql = "UPDATE `account_id` SET `Purchase_Date` = '".$rows['Purchase_Date']."' WHERE `Emp_No` = '".$rows['Emp_No']."' ";
$result = mysql_query($sql, $dblink) or die("load -" . mysql_error());