// try the following loops through the records and assigns the unique #
// the "uid" column is the primaray key value for the table
// change company_table to the name of the company table in your 
database
// change uid to the column name of the unique id field (this could be 
// the company name, if you are sure all company names are different.


        $query="select * from company_table";
//$result returns an array, the routinue will loop through the whole 
array
        $result=mysql_query($query) or die(mysql_error());
        $i=10000;
        while (($row = mysql_fetch_array($result))) {
                $update = "update csv_stage1 set prod_id_num = 
right($i,4) where uid = $row[uid]";
                mysql_query($update) or die(mysql_error());
                ++$i;   
        }


// try this and let me know how this works, you may also want to number 
rows WITHIN a company, for example ABC Company has 5 branches.  you may 
want to do a loop for company id, based on company name, then start a 
new sequence 1,2,3,4,5 for each branch, then start back at 1 again for 
the next company.  

I do a lot of this type of integration and am happy to help

Reply via email to