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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.