How to set User Phone Number as Referral Code?

I want to assign the refer code of each user who is registering to be his phone number. I have used Firebase OTP Authentication and also a Firebase Database Component to store the numbers. But it storing only one number. When I login with another the old one is replaced. Please help me with the blocks so that I can store it to use in the referral system further.

It’s changing because you are overwriting the value of tag ‘Phone_no’.

1 Like

What’s the solution? Can I use TinyDB


Its mean that u r saving values under one same tag for a user
Now see your tag is phone number for storing phone numbers
When u use a second number it again stored in the same tag and replace the old one
U should use a logic so that if the user is using another number then it must be saved in a new tag named as secondary number
And store value of first phine number under a tag named primary number

Use of phone number as a referal code is not a good idea because no everyone wants to share his/hers number with everyone… Got it!?
U should use something different generate a random number
Containg user name + some random numbers + last four digits of his phone number
(its an example u can try other combinations too )
Use sometging unique… Use your logics to develop unique referal numbera for users


You can also use a list, and use append value
But it is quite messy in the firebase.


@Gssingh333 i marked @golumaths100 answer as solution because he was the first to give you this suggestion I just elaborate that idea


@WatermelonIce u r right it can also be used​:+1:

Thank you for your explanation. :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.