# Saving information into the database

**URL:** <https://community.thunkable.com/t/saving-information-into-the-database/1587204>\
**Category:** Questions about Thunkable X\
**Tags:** firebase, cloudinary, beginner\
**Created:** [October 29, 2021, 3:46am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204 "2021-10-29T03:46:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![flansoda](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/flansoda/32/118777_2.png) [@flansoda](https://community.thunkable.com/u/flansoda)\
**Post date:** [October 29, 2021, 3:46am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/1 "2021-10-29T03:46:04Z")

</div>

My app uses a login system with an email, password, and a profile picture. The email and password is being stored but I want to make it so that the profile picture they chose will be saved under that account. I also want to save more information like journal entries under the account. How would I be able to save such information in the database under the user’s account?

 ![code](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/c/0c9005ea7e59b19b4a237bf05e0bfc383988d679.jpeg)

---

<div class="post-metadata">

**Author:** ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)\
**Post date:** [October 29, 2021, 4:21am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/2 "2021-10-29T04:21:43Z")

</div>

I believe you would use ‘Cloud variables’. This video explains how to set them up:

[![](https://img.youtube.com/vi/KvFvSkG6G-k/maxresdefault.jpg "Cloud Variables - Save User Data to the Cloud in Thunkable Drag and Drop UI") ](https://www.youtube.com/watch?v=KvFvSkG6G-k)

---

<div class="post-metadata">

**Author:** ![flansoda](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/flansoda/32/118777_2.png) [@flansoda](https://community.thunkable.com/u/flansoda)\
**Post date:** [October 29, 2021, 5:19am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/3 "2021-10-29T05:19:44Z")

</div>

Thanks for the video. Where can I see the information being stored? How do I save the email, password, and profile picture under the User ID? Is the User ID always going to be the same for the same account?

---

<div class="post-metadata">

**Author:** ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)\
**Post date:** [October 29, 2021, 5:51am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/4 "2021-10-29T05:51:57Z")

</div>

I am not at my computer at the moment so I can’t show you blocks but I believe you need to use the ‘Firebase Realtime DB’. You will need to insert the database URL for that. As for user ID, if you set up authentication on Firbase, when users make an account, you will be able to see their email, username, ID etc.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 29, 2021, 6:02am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/5 "2021-10-29T06:02:30Z")

</div>

You’ll want to use a Firebase database. You can refer to Firebase nodes/properties with cloud variable names.

Start here:

> **[Realtime DB by Firebase](https://docs.thunkable.com/realtime-db)**

---

<div class="post-metadata">

**Author:** ![flansoda](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/flansoda/32/118777_2.png) [@flansoda](https://community.thunkable.com/u/flansoda)\
**Post date:** [October 29, 2021, 6:14am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/6 "2021-10-29T06:14:11Z")

</div>

Hello! I have a Firebase database. I also have Cloudinary to save images. What I don’t understand is how I can connect the two. My login system with Firebase works great, but I am having trouble with saving the image to the account.

---

<div class="post-metadata">

**Author:** ![flansoda](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/flansoda/32/118777_2.png) [@flansoda](https://community.thunkable.com/u/flansoda)\
**Post date:** [October 29, 2021, 7:39am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/7 "2021-10-29T07:39:13Z")

</div>

This is my app so far: [Thunkable](https://x.thunkable.com/copy/f7e70c8ebe6bac0e16a5ab984e909be9)  
I noticed that if I sign up and choose an image, it will make the profile image in the home\_screen that image for every account. For example, when I run the app, if I already have an account and didn’t need to sign up, it would just show the black profile icon in the home\_screen. If I run the app and create a new account, the image that I choose for when I created this account will show up in the home\_screen, which is what I want, but when I log out and log in to a different account, the same image is still there.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 29, 2021, 3:08pm UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/8 "2021-10-29T15:08:14Z")

</div>

When you upload an image to Cloudinary (either manually or from Thunkable blocks), it generates a url for the image. You can then add that url to Firebase.

---

<div class="post-metadata">

**Author:** ![flansoda](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/flansoda/32/118777_2.png) [@flansoda](https://community.thunkable.com/u/flansoda)\
**Post date:** [October 29, 2021, 11:07pm UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/9 "2021-10-29T23:07:38Z")

</div>

Can you show me what code I need to do for that? I don’t know what kind of variable to store it as and how to add the url to Firebase.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 29, 2021, 11:13pm UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/10 "2021-10-29T23:13:26Z")

</div>

If you Google _Cloudinary Thunkable_, the first result should be the documentation for using Cloudinary which includes set up, a video, etc.

Look for the “Upload Media” section of the documentation. Once you generate the green `mediaURL` block, you can save its value to Firebase. To see what Firebase access using cloud variable names looks like, check out this example:

> [@Saving partial data below a Firebase key?](https://community.thunkable.com/t/saving-partial-data-below-a-firebase-key/1588428/5):
>
> Accessing stored variables can be slow so I recommend setting the app variable UserID to stored variable UserID and then using app variable UserID when accessing Firebase.

It took me hours to get this all working. It’s definitely possible but it does take some time to set up and test and troubleshoot.

---

<div class="post-metadata">

**Author:** ![flansoda](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/flansoda/32/118777_2.png) [@flansoda](https://community.thunkable.com/u/flansoda)\
**Post date:** [October 30, 2021, 12:40am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/11 "2021-10-30T00:40:34Z")

</div>

Ok, thank you very much for your help. I have one more question. The User ID is an app variable, the email and password is a stored variable, and the image is a cloud variable, correct?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 30, 2021, 1:22am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/12 "2021-10-30T01:22:11Z")

</div>

Any variables that you want to store in Firebase need to be cloud variables. So that would be all of them. But as you work with them in Thunkable, you may prefer to assign them to app variables in order speed things up a little. You don’t have to do that. As far as stored variables go, that’s for anything you want saved on the user’s device.

---

<div class="post-metadata">

**Author:** ![flansoda](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/flansoda/32/118777_2.png) [@flansoda](https://community.thunkable.com/u/flansoda)\
**Post date:** [October 30, 2021, 4:10am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/13 "2021-10-30T04:10:50Z")

</div>

I’m stumped. I’m still trying to solve this problem but data won’t save into the database. Please take a look at my screenshots. Is there anything I’m doing wrong??

 ![screenshot3](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/5/65cd286342f0a2b544f857e9a01c4ab1ce221828.jpeg)  
 ![screenshot2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/2/a2deeafdfef60ae27dfb58a9c2c6c7f7eb781e82.jpeg)  
 ![screenshot1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/d/edd5126e961231cd8561cdac057b19416659e746.jpeg)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 30, 2021, 4:27am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/14 "2021-10-30T04:27:52Z")

</div>

You have a lot going on. What happens if you separate out the steps? For example:

1. Are you able to select a photo and generate a (green block) url from Cloudinary? If you view that url in a browser does it show the photo you selected?
2. Are you able to change ANY data in Firebase? For example, can you update something simple like a text string?

---

<div class="post-metadata">

**Author:** ![flansoda](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/flansoda/32/118777_2.png) [@flansoda](https://community.thunkable.com/u/flansoda)\
**Post date:** [October 30, 2021, 4:40am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/15 "2021-10-30T04:40:57Z")

</div>

Hi, I checked to make sure everything works. The ones with the stars work for sure but the ones that I squared out seem to have an issue. I’m not able to **add** or **change** any data in Firebase.

 ![screenshot1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/4/343337e88492727a11095eda50b8fd93ccfee877.jpeg)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 30, 2021, 4:55am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/16 "2021-10-30T04:55:22Z")

</div>

I don’t understand the `establishing the data` function at all. I don’t see why you would want to set the userEmail value to anything at that point. Plus, you don’t generally need to check to see if cloud variables are null. That’s really for stored variables.

I would try removing the `establishing the data` function call from the `when signup_screen Opens` block and see if that helps. Also check to see what the value of `stored variable userEmail` + “/image URL” is by setting a label to that value.

Can Firebase nodes have spaces in their names? I don’t think so. Try changing “/image URL” to “/imageURL”.

---

<div class="post-metadata">

**Author:** ![flansoda](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/flansoda/32/118777_2.png) [@flansoda](https://community.thunkable.com/u/flansoda)\
**Post date:** [October 30, 2021, 5:52am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/17 "2021-10-30T05:52:46Z")

</div>

Hi. I removed the `establish the data` function. I also set up a new database for this app and checked to make sure it works. It works, but I found that the issue is in `cloud variable join stored variable userEmail + "/imageURL"`. I removed the space like you said, thank you for catching that. But, it still does not work. I don’t know how to set a label to that value… How can I do that?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 30, 2021, 6:07am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/18 "2021-10-30T06:07:18Z")

</div>

> [@flansoda](#):
>
> I don’t know how to set a label to that value… How can I do that?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/b/5b8498291f7d6d499fe45417c5a011fbdc4e4888.png)

I realized what else seems a little unusual about what you’re doing. I use the green `userId` block in the Sign In block as the Firebase node name. You’re using the email address. I don’t know if the ‘@’ symbol would cause a problem but it’s possible. Maybe it’s okay to use an email address but you might try the userId that Thunkable generates.

I also recommend **not** trying everything at once. You’re still choosing an image, uploading it to Cloudinary, generating a media url, signing up/in to Firebase, changing a Firebase node value… which means that there are soooo many variables for what could go wrong. I don’t mean variables in the programming sense, I mean it in the scientific experiment sense. You need a control. And then one variable that may change. Simplify things so that, for example, you’re using a static value for the cloud variable. Not the email, not a userId… just something like “Bob”. And then you see if you can update Bob/ImageURL with something simple like “test.jpg”. Can you get that to work?

---

<div class="post-metadata">

**Author:** ![flansoda](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/flansoda/32/118777_2.png) [@flansoda](https://community.thunkable.com/u/flansoda)\
**Post date:** [October 30, 2021, 6:30am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/19 "2021-10-30T06:30:30Z")

</div>

> [@tatiang](#):
>
> just something like “Bob”. And then you see if you can update Bob/ImageURL with something simple like “test.jpg”

I got it to work! I think you’re right that the issue is with the stored variable userEmail. I think I might set it to the password instead. I tried doing the User ID, but I call that variable after the user logs in so unfortunately it just says “null” with the image URL under it inside the database. Hopefully setting the cloud variable as the password doesn’t cause an issue. Thank you so much for you help!! 😃

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 30, 2021, 6:32am UTC](https://community.thunkable.com/t/saving-information-into-the-database/1587204/20 "2021-10-30T06:32:41Z")

</div>

You’re welcome. I’m glad you’re getting parts of it to work. I don’t think it’s a good idea to choose the password as the node name. It’s pretty likely that two people might choose the same password and then you have a real problem.

[Next page](https://community.thunkable.com/t/saving-information-into-the-database/1587204.md?page=2)
