I am trying to write a function in Java that updates the description and title fields of a Mysql table however when I pass the int variable 'urlid' nothing is added. If I change the urlid variable (at the very end of the query) to another int variable (for example int i = 2) then it works fine. What is it about this urlid that makes things go wrong?
public void updateDescription( String desc, String title, int urlid ) throws SQLException, IOException {
String cutDesc = desc.substring(0, 99);
Statement stat = connection.createStatement();
String query = "UPDATE urls SET description = '"+cutDesc+"', title = '"+title+"' WHERE urlid =" + urlid;
stat.executeUpdate( query );
stat.close();
}