Good evening, folks,
I'm a beginner in java and I'm creating an interface
connection with the netbeans ide software.
I would also like to link it with a local database with wampserver
The problem is that when I write the code, everything is nicquel but
When I create the account, I get the message register successfully
but in the database nothing appears, please, I have the impression
for screwing up somewhere. my code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try{ String query= "INSERT INTO `user`(`name`, `surname`, `email`, `plan`, `password`, `phone`) VALUES (?, ?, ?, ?, ?, ?)"; con = DriverManager.getConnection("jdbc:mysql://localhost/userregistration", "root", ""); pst = con.prepareStatement(query); pst.setString(1, txtName.getText()); pst.setString(2, txtSurname.getText()); pst.setString(3, txtEmail.getText()); pst.setString(4, cmbPlan.getSelectedItem().toString()); pst.setString(5, txtPass.getText()); pst.setString(6, txtPhone.getText()); pst.executeUpdate(); JOptionPane.showMessageDialog(null, "REGISTER SUCCESSFULLY"); }catch (Exception ex) { JOptionPane.showMessageDialog(null, "REGISTER SUCCESSFULLY"); } }
And also without having put the information in the fields
when I click on "register" I also get the message "register sucessfully"
Thank you for helping me
I have attached the images to my post and the code is highlighted in yellow.
620 280 2.png
620 280.png