500 points. Flash will not load a whole paragraph with & symbol in it. Only whats in front of it.

Im trying to get my information to load into flash from SQL, but only half shows up. Im using Flash 8, PHP, and SQL. Im doing everything right but when flash reads the '&' symbol. It cuts everything off after that. I know in flash and PHP, you use the '&' symbol to separate variables that you are trying to load into flash.

I need everything after the '&' symbol and the '&' symbol to print also.
When i run the PHP file. Everything shows up, but not in flash.

Example:
Event1=September 6, 2007- 1st day of Class for College Park Site
October 6, 2007- 1st day of Class for Smyrna
March 6, 2008 - ParentMeeting /Recital & Costume Money Due for College Park Site
March 8, 2008 - Parent Meeting/ Recital & Costume Money Due for Smyrna Site
SiteOctober 12 13 2007 - Pirouette Dance Conference at Central Baptist Church
November 3, 2007- Pirouette Model Casting Call February 9, 2008- Pirouette Valentines Soirée

This is whats showing in flash:
September 6, 2007- 1st day of Class for College Park Site
October 6, 2007- 1st day of Class for Smyrna
March 6, 2008 - ParentMeeting /Recital

Please Help.
leronj23Asked:
Who is Participating?
 
MasonWolfCommented:
please try:
$Event = rawurlencode($ourData["Event"]);
0
 
Ashish PatelCommented:
Try giving \&
0
 
MasonWolfCommented:
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
leronj23Author Commented:
I tried htmlspecialchars and it didnt work. basicly if someone is writing a posting on my site and decide to use '&' instead of 'and'. then it should show up. I dont know if something needs to change in Flash or PHP.

Flash:
loadText = new LoadVars();
loadText.load("Load_Event_Info.php");
loadText.onLoad = function(){
EventBox.text=loadText.Event1;}

PHP:
print("Event1 = $Event);

Didnt work:
print(htmlspecialchars("Event1=$Event"));

when i ran the php file. Everything showed up. But everything wont show up in Flash.
0
 
MasonWolfCommented:
Hmm. Sorry, I'm not really a Flash programmer. I just assumed that was where your problem was. I did a quick Google search and I think I found the solution: http://www.jabbypanda.com/blog/?p=4

Basically, Flash needs the text to be url-encoded. So use "$html = urlencode($html);"
http://us2.php.net/manual/en/function.urlencode.php
0
 
leronj23Author Commented:
Well i tried the example and it didnt work. i just want whatever the customer inputs in. it will show up. This shouldnt be so hard to do. :o(
0
 
MasonWolfCommented:
Ah, I just looked at the link I provided again. Apparently, "+" is a special character that needs to be escaped. With url encode, spaces become '+'. Try using "rawurlencode()" instead.
0
 
leronj23Author Commented:
i've read that it has something to do with Flash not reading special characters.
0
 
Ashish PatelCommented:
escape(text) is the function being used in flash.
0
 
leronj23Author Commented:
asvforce, i dont understand.
0
 
Ashish PatelCommented:
Event1=escape("September 6, 2007- 1st day of Class for College Park Site
October 6, 2007- 1st day of Class for Smyrna
March 6, 2008 - ParentMeeting /Recital & Costume Money Due for College Park Site
March 8, 2008 - Parent Meeting/ Recital & Costume Money Due for Smyrna Site
SiteOctober 12 13 2007 - Pirouette Dance Conference at Central Baptist Church
November 3, 2007- Pirouette Model Casting Call February 9, 2008- Pirouette Valentines Soirée")
0
 
thebrainmanCommented:
can you show us your ActionScript and PHP code so we can see whats going on?
0
 
leronj23Author Commented:
PHP:
$query = @mysql_query("SELECT Event FROM $MainTable WHERE Id = '1'");
while($ourData = @mysql_fetch_array($query)){
$Event = $ourData["Event"];}

print("Event1=$Event");

This is what is printed when PHP is ran by itself:
Event1=September 6, 2007- 1st day of Class for College Park Site
October 6, 2007- 1st day of Class for Smyrna
March 6, 2008 - ParentMeeting /Recital & Costume Money Due for College Park Site
March 8, 2008 - Parent Meeting/ Recital & Costume Money Due for Smyrna Site
SiteOctober 12 13 2007 - Pirouette Dance Conference at Central Baptist Church
November 3, 2007- Pirouette Model Casting Call February 9, 2008- Pirouette Valentines Soirée

Flash:
loadText = new LoadVars();
loadText.load("Load_Event_Info.php");
loadText.onLoad = function(){
EventBox.text=loadText.Event1;}

In Flash i get this:
September 6, 2007- 1st day of Class for College Park Site
October 6, 2007- 1st day of Class for Smyrna
March 6, 2008 - ParentMeeting /Recital

When i should get this:
September 6, 2007- 1st day of Class for College Park Site
October 6, 2007- 1st day of Class for Smyrna
March 6, 2008 - ParentMeeting /Recital & Costume Money Due for College Park Site
March 8, 2008 - Parent Meeting/ Recital & Costume Money Due for Smyrna Site
SiteOctober 12 13 2007 - Pirouette Dance Conference at Central Baptist Church
November 3, 2007- Pirouette Model Casting Call February 9, 2008- Pirouette Valentines Soirée

When i take the '&' symbol and change it to 'and' it works. Everything shows up.
I know in PHP you used the '&' symbol to seperate variable being printed to Flash, but i know some how Flash came up with a way to override that if people decided to used the '&' in a paragraph or sentence.
0
 
leronj23Author Commented:
MasonWolf you are great thank you. thats exactly what i needed it to do.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.