Save data to a specific user in firebase

Prueba2


Hi, everyone! In advance, I really thank you for your time and patience.
I have created users in firebase from my register screen but now I want to save data (scores) from another screeen for each user. Despite the fact that I have read documentation, search for help in tutorials and dedicated time to solve it for myself, I will be happy if I can get some help from you, thunkers.

1 Like

First you need to create an app variable to hold the userId in the login / registration screen.
Then in the other screen use this variable to generate the key for the firebase entry.

image

1 Like

I can’t thank you enough for your diligent help. I did exactly what you told me and it has worked perfectly. Thank you for your support.

2 Likes

prueba1.2


@muneer I am sorry for keeping asking basic questions. These are my blocks but for some reason the scores are overwritten. Do you know what am doing wrong?

Once again, thank you very much for your pricesless help

1 Like

Yes, this is correct.
Under scores you are saving some values. Every time you call the Save block, you are overwriting existing values.

You have two options:

  • Use counters for the scores to avoid overwriting. Example score/1, score/2, score/3 so that every time you increase the number and you will have your scores saved under the number not directly under the score key.

  • Use lists. In the object under scores don’t save the score variable directly but save a list of scores and every time you update the list. When you save, the updated list will be saved.

Let me know if you need more clarification.

1 Like

I am feeling bad for bothering but do you allow me to direct message you, mr. @muneer ?

1 Like

If you feel you want to discuss your project details privately, feel free to send me direct messages.

2 Likes