public static string[] getFriends(string email) //returns string array that contains emails of all friends { //CheckifUserhasfriends if (friendExists(MySQLFunctions.getAccountIDNext(email)) != "") //Returns 1 for 1 friend { string[] returnString = new string[int.Parse(getTotalFriends(email))]; //Array of size 1 string connectionString; MySqlConnection cnn; string query; MySqlCommand cmd; MySqlDataReader dr; string home; int ID; int j = 0; for (int i = 0; i < int.Parse(getTotalAccounts()); i++) { ID = i + 1; if (MySQLFunctions.innerFriendExists(ID.ToString()) != "") { connectionString = $"server=localhost;database=SNHUBook;uid=root;pwd={MYSQLPassword};"; cnn = new MySqlConnection(connectionString); query = $"SELECT email FROM friends WHERE ID like {ID.ToString()};"; cmd = new MySqlCommand(query, cnn); cnn.Open(); dr = cmd.ExecuteReader(); home = string.Empty; while (dr.Read()) { home = dr.GetString(0); Console.WriteLine(home); } dr.Close(); cnn.Close(); returnString[j] = home; j++; } } return(returnString); } else { return(new string[0]); } }