I think John's right. Your schema sounds like it needs some serious work, especially if you're storing identical details with every single transaction. Go back and study relational database basics before trying to create an inventory management system or you'll end up in a world of hurt.
-Ed > -----Original Message----- > From: Dave Carrera [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 11, 2004 11:14 AM > To: 'Jason Davidson' > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP] Adjust two or more mysql rows ? > > I am deving a goods in system that REQUIRES that each delivery of items be > entered into raw stock separately. This is why two rows in the table have > identical details like, > > Supplier > Product name > > But the qtys may be diff. > > Ect ect > > Now the PREPARATION dept need to internally order the RAW STOCK to make > the > final items for sale. SO they order from RAW STOCK items they want and > this > is where the RAW stock reductions come in. > > To keep it simple, I group the identical items available to the PREP team > showing only the total in raw stock. They enter what they need and this is > where I want to reduce the raw stock until I have reached the total > ordered > by the PREP team. > > I am having a look at array_walk to see if that can help but ask yourself > or > the list if you have any ideas how I can step through each returned row > adjusting the qty level until I reach 0 which the posted value. > > I hope that helps > > Dave Carrera > > > > -- > UK Web Hosting @ http://www.ephgroup.com > > > -----Original Message----- > From: Jason Davidson [mailto:[EMAIL PROTECTED] > Sent: 11 August 2004 19:00 > To: Dave Carrera; [EMAIL PROTECTED] > Subject: Re: [PHP] Adjust two or more mysql rows ? > > > Yup, confused me... > what is it for? > > J > "Dave Carrera" <[EMAIL PROTECTED]> wrote: > > > > Hi List, > > > > I have a qty posted via a form field, lets say 46. > > > > In my mysql table I have two rows which I want to reduce their qty > > fields. > > > > 1 row has a qty of say 13 and the second has a qty of 50, making 63 in > > total. > > > > So I would like to say something like if $_POST[qty] is greater than > > row 1's qty then update row[qty] = 0, then minus what was the row qty, > > 13 , from $_POST[qty] to new var say $newqty = $_POST[qty]-$row[qty], > > this leaves 37. > > > > Then from the 2nd row take 37 from its qty of 50 leaving 13. End > > result being row 1's qty field = 0 and row 2's qty field = 13. > > > > I hope this is not as clear as mud and if you need further clarity to > > be able to advise me then I will be happy to correspond. > > > > I thank you fully in advance for any help, logic pointers or nuggets > > of wisdom. > > > > Dave Carrera > > > > > > -- > > UK Web Hosting @ http://www.ephgroup.com > > > > --- > > Outgoing mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php