View RSS Feed

blustar angel

problem with shopping cart

Rate this Entry
by , 08-29-2012 at 02:15 PM (2603 Views)
how do i increase the quatity of an item when it is added again and again into my shopping cart table.there is only a button add to cart.there is no textfeild for quantitiy.
the code as of now i have retreives the items from database and add it into the shipping cart table. if i clik on it again and again the same item wil be shown again and again.
Java Code:
 DefaultTableModel model = (DefaultTableModel) 
tbl1.getModel();
            DefaultTableModel tm = (DefaultTableModel) 
tbl2.getModel();
            int a = tbl1.getSelectedRow();
            if (a == 0) {
                
                try {
                    Class.forName("java.sql.Driver");
                    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/album", "root", "123");
                    Statement stm = con.createStatement();
                    String sql = "select ALBUMNAME,PRICE FROM albums WHERE ALBUMNAME='twilight' ;";
                    ResultSet res = stm.executeQuery(sql);
                    while (res.next()) {
                        String ALBUMNAME = res.getString("ALBUMNAME");
                        int PRICE = res.getInt ("PRICE");

                        tm.addRow(new Object[]{ALBUMNAME, PRICE});
                    }
                    res.close();
                    con.close();
                    stm.close();
                    


                } catch (Exception e) {
                    JOptionPane.showMessageDialog(null, "error in connectivity");
                }

Submit "problem with shopping cart" to Facebook Submit "problem with shopping cart" to Digg Submit "problem with shopping cart" to del.icio.us Submit "problem with shopping cart" to StumbleUpon Submit "problem with shopping cart" to Google

Tags: None Add / Edit Tags
Categories
Uncategorized

Comments