I am trying to get a row and convert it to a array I alredy tried to convert the resultset.getArray() to a ArrayList but for some reason it returned nothing somebody help me with this
code now:
public ArrayList<String> getReport(String name) {
try {
Statement sql = mySql.getConnection().createStatement();
ResultSet resultSet = sql.executeQuery("SELECT * FROM `reports` WHERE `reportedplayer`='" + name + "';");
if(!resultSet.next()) {
sql.close();
resultSet.close();
return null;
}
ArrayList<String> rowValues = new ArrayList<String>();
while (resultSet.next()) {
rowValues.add(resultSet.getString("reason"));
}
sql.close();
resultSet.close();
return rowValues;
}catch (SQLException e) {
e.printStackTrace();
return null;
}
}
whileloop.