PDA

View Full Version : % symbol not loading from PHP/MySQL


MichaelMMD
10-06-2008, 12:53 AM
At times a user needs to enter a % symbol in a PHP text field that posts to MySQL and then is retrieved by Flash loadVars through PHP select. The % is stored as text in MySQL and displays in PHP as text but does not load into Flash. Is there a character code or escape or encoding that can be used so that it displays as text in Flash?
Thanks,
Michael

CyanBlue
10-06-2008, 02:21 PM
Howdy and Welcome... :)

You basically need to use '%25' in place of '%' because '%' has special meaning...
http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14143&sliceId=2

MichaelMMD
10-07-2008, 11:50 PM
Thanks for the direction, it opened up a number of alternatives. I am loading the variables into physical text fields, so embedding the '%' symbol allowed '%25' to work. It is not a problem for this project, but as I am storing the '%25' in MySQL, it now displays in the PHP CMS preview as '%25'. For display purposes in PHP, do I now need to strip the Unicode and replace with the '%' character since the data is passing through dynamically and not being saved as Unicode?
Thanks much,
Michael

CyanBlue
10-08-2008, 12:09 AM
Basically you need to decode that to become a HTML string again...

http://us.php.net/manual/en/function.urldecode.php