Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL data into dynamic text field without escape sequence!!

Status
Not open for further replies.

joshley

Technical User
May 23, 2007
2
CA
Hi guys,

I got a music portfolio web site running PHP, MySQL and Flash. There's a page showing all the artists my client worked for and when you click on a song title, this title is passed as a variable to a PHP page then to a Flash page. The Flash page contains an actionscript music player which then looks for the right audio file in the database and plays the song. Everything works great except for the dynamic text field which displays the song title. If the song title contains an apostrophe or a single quote, the Flash dynamic text field then shows the apostrophe preceded by a \.

Here's an image :
quote_bug.jpg



For example, the song Breaking up somebody's home (by Nanette Workman) is written as is into the MySQL database. The display into the HTML page is fine ( no \), The problem is with the Flash dynamic text field.

The problem I think, is that PHP variables are sent to the Flash player and one of these variables contains a string with single quotes in it (the actual song title). Here's the partial code that points the problem :

Code:
<?php
	while($arrAudio = mysql_fetch_assoc($resultAudio))
	{
		$aTitle = $arrAudio["Title"];
		$aFile = $arrAudio["File"];
		$counter = $counter + 1;
	?>
	Track <?=$counter?> / <em>Plage <?=$counter?></em> : <a href="<?=$_SERVER['PHP_SELF'].'?audioname='.$aTitle.'&audiofile='.$aFile.'&imagefile='.$flashImage?>" target="_blank"><?= $aTitle ?></a><br />
	<?php


Where $aTitle is the song title containing a single quote. How can I tell Flash to NOT escape the single quote ?


The actual site is here :
Many thanks in advance.

Joshley
 
Hi,

I finally found the solution. Inside the file that's going to be read by Flash, just wrap the variable with a stripslashes() function.

Code:
$audioname = stripslashes($audioname);

Joshley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top