Ok, here is the code that is giving me trouble...
if (is_uploaded_file($FILES['file']['tmp_name'])) // if the file uploaded
{
$file_realname = $FILES['file']['name'];
copy($_FILES['file']['tmp_name'], "$file_realname"); //Copy to server
if(@$filetype == "qbooks") // did this come from a certain form on the site?
{
$query = "TRUNCATE TABLE quickbooks_inv"; // clear old data out of table
$updated = mysql_query($query) or die ("Could not Clear Database");
//insert data from IIF file into table from file uploaded
$num = 0;
$row = 0;
$id = fopen("FILE URL GOES HERE".$file_realname,"r"); //open the file
while ($data = fgetcsv($id, 5000, "\t"))
{
$num = count ($data);
$row++;
for ($c=0; $c < $num; $c++)
{
if($data[$c] == "INVITEM") // This entry in the data indicates the beginning of an inventory item in the file
{
if($data[4] == "INVENTORY") // make sure it is of this catagory
{
if(($data[10] != "") AND ($data[10] != 0)) // only if there is one or more in inv
{
$itemnumber = $data[1];
$itemnumber = htmlspecialchars("$itemnumber", ENT_QUOTES);
$mfg_= $data[22];
$mfg = htmlspecialchars("$mfg", ENT_QUOTES);
$datecode_= $data[23];
$datecode = htmlspecialchars("$datecode", ENT_QUOTES);
$quant_= $data[10];
$quant = htmlspecialchars("$quant", ENT_QUOTES);
$description_= $data[5];
$description = htmlspecialchars("$description", ENT_QUOTES);
$nsn = $data[26];
$nsn = htmlspecialchars("$nsn", ENT_QUOTES);
$condition = $data[25];
$condition = htmlspecialchars("$condition", ENT_QUOTES);
$crossref = $data[24];
$crossref = htmlspecialchars("$crossref", ENT_QUOTES);
$query = "INSERT INTO quickbooks_inv (qb_itemnumber, qb_mfg, qb_datecode, qb_quantity, qb_description, qb_nsn, qb_condition, qb_crossref) VALUES ('$itemnumber','$mfg','$datecode','$quant','$description','$nsn','$condition','$crossref')";
$updated = mysql_query($query) or die ("Could not update record ($row-1) - $c");
}
}
}
}
}
//delete file uploaded
unlink("$file_realname");
echo "TEMP FILE DELETED FROM SERVER<BR><BR>";
} // end if qbooks
}
else // (not uploaded)
{
echo "<b><font color=red>No file uploaded.</font></b><BR>No file available or file too big to upload.";
$file_realname = "";
}
Can anyone see why any of those variables that I an trying to put into the database would not be populating with numerical data (Especially the $quant variable)?
Thanks