Jump to content

data entry in firebase


yhi

Recommended Posts

i am using php to generate some stuff & using javascript to insert those stuff in my firebase DB

 

but now the problem is some of those generated strings contain some html anchor tag in them so my JS script is refusing them & they are not getting inserted because they contain single quote

i tried to replace single quote with double quote but then firebase is adding a backslash before every " so those anchor tags are not working when i am showing DB on a page

 

 

so far i was only able to think about one solution that i should remove all single & double quote & href will still work & i can replace space with %20 so the link will not get broke

 

example generated string by my php

 

hello <a href='https://forums.phpfreaks.com'>PHP freaks</a>

 

my JS script


[API keys]

firebase.initializeApp(config);
var database = firebase.database();
var ref = database.ref('phpfreaks');
var data = {
		text: '$text1',
		text2: '$text2'
		}
ref.push(data);

PS

 

i cant remove single quote before my variable in JS script

if i do so the data will not get entered...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.