all groups > flash data integration > may 2007 >
You're in the

flash data integration

group:

MySQL data into dynamic text field without escape sequence!!


MySQL data into dynamic text field without escape sequence!! joshley2
5/23/2007 6:59:23 PM
flash data integration:
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 http://www.pierrepineault.com/quote_problem/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?> / [I]Plage <?=$counter?>[/I] : <a
href="<?=$_SERVER['PHP_SELF'].'?audioname='.$aTitle.'&audiofile='.$aFile.'&image
file='.$flashImage?>" target="_blank"><?= $aTitle ?></a><br />
<?php
[/code]


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 : http://www.pierrepineault.com/contentFrame.php

Many thanks in advance.

Joshley2

Re: MySQL data into dynamic text field without escape sequence!! joshley2
5/24/2007 8:50:21 PM
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);

[/CODE]

Joshley
AddThis Social Bookmark Button