|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello everyone and let me say thank you for the . I'm developing
an inventory program using PHP and MySQL. So far I have the php developed where you can enter a bar code, and type a quantity, and it will log the serial and the quantity of that serial in the DB. What I really want it to do is look to see if the bar code is already in the database, and if so, then it simply adds the quantity that is being input to the quantity value already in the DB. Presumably I also need to subtract from the DB in a similar manner. Any ideas? Thanks so much, Brian |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On 14 Apr, 14:34, Brian Spotts <neoca...@gmail.com> wrote:
> Hello everyone and let me say thank you for the . I'm developing > an inventory program using PHP and MySQL. So far I have the php > developed where you can enter a bar code, and type a quantity, and it > will log the serial and the quantity of that serial in the DB. What I > really want it to do is look to see if the bar code is already in the > database, and if so, then it simply adds the quantity that is being > input to the quantity value already in the DB. Presumably I also need > to subtract from the DB in a similar manner. Any ideas? > Thanks so much, > Brian INSERT INTO ... SET..... ON DUPLICATE KEY UPDATE .... |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
excellent! Thanks for the quick response, but I'm relatively new to
mysql and php so is there any way you could elaborate on how to use the command? I'm assuming its something like... INSERT INTO ~tablename~ SET ~i'm not sure~ ON DUPLICATE KEY UPDATE ~quantity + "quant"~ I know that's not right, sorry I need more but I'm happy to realize that it seems to be an easy thing to do for people with more experience. thanks so much. -Brian |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On 14 Apr, 15:25, Brian Spotts <neoca...@gmail.com> wrote:
> excellent! Thanks for the quick response, but I'm relatively new to > mysql and php so is there any way you could elaborate on how to use > the command? I'm assuming its something like... > INSERT INTO ~tablename~ SET ~i'm not sure~ ON DUPLICATE KEY UPDATE > ~quantity + "quant"~ > > I know that's not right, sorry I need more but I'm happy to > realize that it seems to be an easy thing to do for people with more > experience. thanks so much. > -Brian There's a phrase that goes with this. Its initials are RTFM Even us "people with more experience" do this. Indeed, it is where we manage to get our experience. It is said that "the Lord s those who themselves". A similar thing applies here. http://dev.mysql.com/doc/refman/5.0/en/insert.html |
|
![]() |
| Outils de la discussion | |
|
|