PDA

View Full Version : How do I put a percentage sign in a text string loading from database?



3dron
February 6th, 2003, 05:55 PM
I have everything working! I can change my database text, and call it from my flash through php. But it doesn't seem to translate over the '%' sign.

I know this is probably not database specfic.

"Text=Test text&Comment=Take 10% off all products"

The variable Comment only comes out as:

Take 10 of all products.

Do I use an escape character?

Thanks for any help

Ron

ahmed
February 6th, 2003, 10:59 PM
try \%.. not sure if it'll work though..

h88
February 6th, 2003, 11:04 PM
&Comment=Take 10%25 off all products

3dron
February 7th, 2003, 02:35 AM
Thanks, worked perfectly. Where is the documentation for this?

What part is making it work the '25', or is '%25' an escape character for '%'?

Thanks

Sraet
February 7th, 2003, 05:43 AM
Just a guess here, I see no "" anywhere, so Im guessing it only uses key characters when parsing strings within a ""

again, just an assumption from other programming languages.

pom
February 7th, 2003, 09:03 AM
Everything should be in the AS Dictionary :)

And the whole thing makes it work. I believe it's % and then the ASCII code.

h88
February 7th, 2003, 01:35 PM
Originally posted by 3dron
What part is making it work the '25', or is '%25' an escape character for '%'?

'%25' = %


Originally posted by 3dron
Where is the documentation for this?

Simply, do the following:

string = "%"
trace(escape(string));

pom
February 8th, 2003, 10:48 AM
Just to split hair a bit more, don't call your variable string, it's confusing, and it might be a reserved word :)