Commit b939d186 authored by Deokhyun Lee's avatar Deokhyun Lee

added updateUserInfo

parent fdb013f6
......@@ -161,4 +161,28 @@ public class MemberDaoImpl implements MemberDao {
}
}
}
public void updateUserInfo(String email, String password, String changePassword) {
String table = "SELECT * FROM mytestdb.major_table";
String sql = "UPDATE mytestdb.major_table SET password=? WHERE email=?";
PreparedStatement pstmt = null;
PreparedStatement pstmtTable = null;
try {
pstmtTable = conn.prepareStatement(table);
pstmt = conn.prepareStatement(sql);
ResultSet rs = pstmtTable.executeQuery();
while(rs.next()){
if (rs.getString("email").equals(email) && rs.getString(password).equals(password)){
pstmt.setString(1, changePassword);
pstmt.setString(2, email);
pstmt.executeUpdate();
System.out.println("수정된 이름: " + changePassword);
break;
}
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment