title: How to compare user input with my database in java
body: <p>As shown on the title, I have tried so hard to compare the user input with my database and it works with a true input. However, when the input is not exist on my database I don't know what is wrong in my below code, please help.</p>
  
  <pre><code>private class da implements ActionListener{
   public void actionPerformed(ActionEvent e){
             Connection con = null;
  
        String url = "jdbc:mysql://localhost:3306/المكتبة";
        String unicode = "?useUnicode=yes&amp;characterEncoding=UTF-8";
    try{
  con = DriverManager.getConnection(url+unicode,"root","");
  
   PreparedStatement upd = con.prepareStatement("SELECT * FROM library WHERE author =?'");
   upd.setString(1,name.getText());
   ResultSet rs = upd.executeQuery();
  
  
  while(rs.next()){
      String authorname = rs.getString("author");
      String bookname = rs.getString("bookname");
      String categort = rs.getString("category");
      int isbn = Integer.parseInt(rs.getString("ISBN"));
      String data = "اسم المؤلف: "+authorname+"\n"+"اسم الكتاب: "+bookname+"\n"+"التصنيف: "+categort+"\n"+"ISBN: "+isbn;
  
  
   if(name.getText().equals(authorname))
       txt.setText(data);
   else
       txt.setText("no matches");
  </code></pre>