This was the solution I worked out:
<?
// Drop Table
$db = mysql_connect("localhost", "name", "password") or die("Couldn't Connect.");
mysql_select_db("tablename",$db) or die("Couldn't Select.");
$query = "DROP TABLE classicdye";
mysql_query($query);
// Create Table
$query2 =
"CREATE TABLE tablename (
id int(4) DEFAULT '0' NOT NULL auto_increment,
name text,
color text,
ci int(5),
quantity text,
price float(10,2),
srchcolor text,
type text,
PRIMARY KEY (id),
UNIQUE id (id)
);";
mysql_query($query2);
// open file
$file = "file/" . $fileupload_name;
$myfile = file($file);
$tmp1 = "INSERT INTO classicdye (name,color,ci,quantity,price,srchcolor,type) VALUES (";
$tmp3 = ");";
$count = count($myfile);
$loop = 0;
while($loop < $count){
$tmp2 = $tmp1 . $myfile[$loop] . $tmp3;
//echo $tmp2;
mysql_query($tmp2) or die("error");
$loop ++;
}
echo "Database Updated";
?>
Thanks for the help.
moonie 😉