# How to get array from append array

**URL:** https://discourse.processing.org/t/how-to-get-array-from-append-array/38580
**Category:** Libraries
**Created:** [August 31, 2022, 8:14am UTC](https://discourse.processing.org/t/how-to-get-array-from-append-array/38580 "2022-08-31T08:14:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![RNWA](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@RNWA](https://discourse.processing.org/u/RNWA)
#### Post date: [August 31, 2022, 8:14am UTC](https://discourse.processing.org/t/how-to-get-array-from-append-array/38580/1 "2022-08-31T08:14:07Z")

</div>

```auto
import de.bezier.data.sql.*;

String dbHost = "localhost"; // if you are using a using a local database, this should be fine
String dbPort = "3306"; // replace with database port, MAMP standard is 8889
String dbUser = "root"; // replace with database username, MAMP standard is "root"
String dbPass = ""; // replace with database password, MAMP standard is "root"
String dbName = "tes"; // replace with database name
String user = "ebbg678";
String[] status={};
String[] username={};
String[] userON={};
MySQL msql;

void setup() {
  msql = new MySQL( this, dbHost + ":" + dbPort, dbName, dbUser, dbPass );

  if (msql.connect()) {
    msql.query("SELECT * FROM tes");
    while (msql.next()) {
      status = append (status, msql.getString("STATUS"));
      username = append (username, msql.getString("USERNAME"));
      for (int i = 0; i < username.length; i++) {
        if (status[i] == "ON") {
          userON = append (userON, username[i]);
        }
      }
    }
  } else {
    println("Yikes, there was an error!");
  }
  print(userON[0]);
}

```

please help i can’t append my array string from my database. Where did i go wrong?
