So I have this code, and I want it to print out a question in the console for each value for me to fill in and later then update that in the database, for example:
--- Insert required information ---
Supplier name: Frank & CO
Supplier email: frankandco@franks.com
Supplier phonenumber: 0702943814
Supplier contactperson: Frank Earnest
I am not sure though as to how to do it, could I do this with an if loop? and if, how?
public void insertSupplier() {
try {
cn = DriverManager.getConnection(DB_ADDRESS, DB_USER, DB_PASS);
pstat = cn.prepareStatement("INSERT INTO supplier (supplier_name, supplier_email, supplier_phonenumber, supplier_contactperson) VALUES (?,?,?,?)");
String supplier = scan.nextLine();
pstat.setString(1, supplier);
pstat.executeUpdate();
System.out.println("Supplier added to database");
cn.close();
} catch (SQLException e) {
System.out.println(e);
}
}