Question: I have the following structure in firebase database:

```
"profiles": {  
   "user_id" : {
      "id_profile_1" : {
          "photos" : ".."
          "selected" : "0"
       },
      "id_profile_2" : {
          "photos" : ".."
          "selected" : "0"
       }, 
      ...
   }
}

```

Is there any way to update simultaneously all the "selected" field in all the children at once?

I'm making this:

```
let ref = FIRDatabase.database().reference()
let post = ["selected": "-1"]
ref.child("profiles").child("user_id").updateChildValues(post)

```

But it adds a new child at the "user\_id" level.

Thanks!

**UPDATE**

To clarify, the actual structure looks like this:

```
"profiles": {  
   "AZWul77p47.." : {
      "KeC9NCb4Kh..." : {
          "photos" : ".."
          "selected" : "1"
       },
      "Kj4yZOd6aJ..." : {
          "photos" : ".."
          "selected" : "0"
       }, 
      ...
   }
}

```

And when a user selects a different profile in the app the "selected" of this profile changes to "1" and all the others to "0". That's why I want to update all the others "selected" to "0" in one call.

Answer: 
```
else if((income <= 79999) && (income >= 55000));
                                              ^^^

```

Take out that semi-colon.
It should run correctly now.
**Firstly**, you have a terminating character at the end of your else-if header:

```
else if((income <= 79999) && (income >= 55000));

```

The semicolon splits the else-if header fom its body, makin the body non-conditioned executable part of your function. To fix this, just remove the semicolon:

```
else if((income <= 79999) && (income >= 55000)) // no semicolon needed

```

**Also**, your function is supposed to return an `int` value, based on te definition of the function `catagory()`. You need to either add a `return`statement at the end of your function or change the return type of your function to `void`.