Count quantity for the same id product in a table | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Count quantity for the same id product in a table

I've problem with java (I'm using netbeans) when build an simple application to log product in a table. Product id is entered in a field text and detect it in a database for taking product detail. for default entry, quantity is 1 then if the same product is entered, quantity column adds 1 automatically. It works in first entry. But, when i add other product, it messed up. how do i fix it? this the code https://code.sololearn.com/cR0pGqt1ULal/?ref=app this the pict https://i.stack.imgur.com/pV3Gh.png

25th May 2018, 7:21 PM
Putri Alvina Lutfiani
Putri Alvina Lutfiani - avatar
2 Answers
+ 1
use the concept of primary and unique key. while create the table in database.. so that it not mixed up.. while adding information into it..
26th May 2018, 2:17 AM
Arun Tomar
Arun Tomar - avatar
+ 1
Thanks for answering
26th May 2018, 7:58 AM
Putri Alvina Lutfiani
Putri Alvina Lutfiani - avatar