I really appreciate the help. I just have one more minor problem with this whole concept. First i'll show the code then describe my concern:
<?
//check for file upload
if(isset($UploadedFile1)) {
print("Local File: $UploadedFile1 <BR>");
print("Name: $UploadedFile1_name <BR>");
print("Size: $UploadedFile1_size <BR>");
print("<HR>");
if ($UploadedFile1<>"none")
if(!copy($UploadedFile1,"/usr/local/etc/httpd/vhosts/udllabs/data/".$UploadedFile1_name))
print "File failed to upload";
}
?>
<?php
if ($submit) {
$db = mysql_connect();
mysql_select_db("udllabs");
mysql_query("DROP TABLE IF EXISTS products");
mysql_query("create table products (
amerisource VARCHAR(20) NULL,
bbc VARCHAR(20) NULL,
bindley_western VARCHAR(20) NULL,
cardinal_corp VARCHAR(20) NULL,
cardinal_whitmire VARCHAR(20) NULL,
mcKesson VARCHAR(20) NULL,
morris_dickson VARCHAR(20) NULL,
ndc VARCHAR(255) NULL,
product_description VARCHAR(255)NULL,
size VARCHAR(255) NULL,
code VARCHAR(255) NULL,
manufacturer VARCHAR(255) NULL,
compare_product VARCHAR(255) NULL,
compare_mfg VARCHAR(255) NULL,
te_rating VARCHAR(255) NULL,
color VARCHAR(255) NULL,
shape VARCHAR(255) NULL,
id_side1 VARCHAR(255) NULL,
id_side2 VARCHAR(255) NULL,
intro_date VARCHAR(255) NULL,
wholesale VARCHAR(255) NULL,
awp VARCHAR(255) NULL,
product_status VARCHAR(255) NULL,
status VARCHAR(255) NULL,
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY)"
);
mysql_query ('load data infile "/usr/local/etc/httpd/vhosts/udllabs/data/products.csv" into table products FIELDS TERMINATED BY "," ENCLOSED BY "\"" ');
$timestamp = strtotime($intro_date);
$converted_date = date("Y-m-d", $timestamp);
mysql_query("UPDATE products SET code = 'Bingo Card' WHERE code = 'O'");
mysql_query("UPDATE products SET code = 'Robot Ready' WHERE code = 'R'");
mysql_query("UPDATE products SET code = 'Emergi-Script' WHERE code = 'S'");
mysql_query("UPDATE products SET code = 'Unit Dose' WHERE code = 'A' OR code = 'B'");
mysql_query("UPDATE products SET intro_date = '$converted_date'");
echo "<p>Thank you! The UDL product database has been updated.</p><br>";
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<input type="Submit" name="submit" value="Update Product Database">
</form>
<?php
} // end if
?>
I'm using load data rather than insert statements because i'm using a web form to upload the data then a link to active it or load it into the db.
With this method of yours, is there a way to actually convert the 486 dates ( they're not all the same date) to the yyyy/mm/dd format after they are loaded into there column in the db. The way that i have it set up above changes them all but, they all change to the same date. Whatever is first is what they ALL change to.
thanks again