Hi,

I'm not sure if this belongs in this forum or the PHP forum, but I have a database ("inventory-db") that looks like

Sample.jpg

The database in phpMyAdmin has over 16,000 lines of data. What I am trying to do is mass update the outofstock field with another spreadsheet that looks like

CSV.jpg

The spreadsheet may have anywhere from 1,000 to 10,000 lines of data. Currently, I upload the CSV spreadsheet on a password protected web page (inventory.php) via a form post.

HTML Code:
<form action=inventory.php method=post enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
Inventory File:&nbsp;&nbsp;&nbsp;<input name="inventory" type="file">
<br><br><input type=submit name="update" value="Upload Inventory">
</form>
Once the form submits to the same page, I have it go through the CSV file to update the outofstock column in the database.

PHP Code:
    $filename $_FILES['inventory']['tmp_name'];    
    
$handle fopen($filename"r");

    while ((
$inventory fgetcsv($handle10000",")) !== FALSE)
    {
        
$product mysql_query("SELECT * FROM `inventory-db` WHERE `MPN` = '" $inventory[0] . "'");

        
$count 0;

        while (
$tmp mysql_fetch_array($product))
        {
            
$count $count 1;
        }

        if (
$count == 0)
        {
            if (
$inventory[2] <> "0")
            {
                echo 
$inventory[0] . " (" $inventory[1] . ") is not listed on website.<BR>";
            }
        }

        
/* Update outofstock */
        
if ($inventory[2] <> "0")
        {
            
mysql_query("UPDATE `inventory-db` SET `outofstock` ='0' WHERE `MPN` = '" $inventory[0] . "'");
        }
        else
        {
            
mysql_query("UPDATE `inventory-db` SET `outofstock` ='1' WHERE `MPN` = '" $inventory[0] . "'");
        }
        
    } 
So my problem is that this works about 10% of the time. It seems when I put a larger CSV file through the process, it does not respond, and I have done some research on file upload restrictions within php.ini, but I do not see what would be the restriction with the settings that I have. I would greatly appreciate any suggestions on how to fix this current process or a more efficient way to get the database updated using a secondary spreadsheed of some sort.