Flash and PHP

I have managed to get my dynamic data read into a flash dynamic text box. Using MySQL and PHP.

MY problem is when I add and extra column to my output which are basically links it stops.

Now I have discovered the problem but I am struggling on how to get a solution:

I have to print out :HEADING, DATE, TEXT and EXTERNAL LINK, not using the code I have at mo but leaving the output of the EXTERNAL LINK it displays all the db info, but then I add the EXTERNAL LINK to my php out put and then in flash it displays the first record and stops at the EXTERNAL LINK output.
The issue is that my links are not the normall ones: www.site.co.uk, but have parameters attached to them like www.site.co.uk?para1=123&para2=432.

now it displays as mentioned up to the first link as far as www.site.co.uk?para1=123 so the issue I beleive is that its taking the ‘&’ as the end and is not appending anything else after this

If someone knows of a solution to this could they assist, I have put up my PHP and FLASH code for reference. I thing is that the links will not be under my control so the ‘&’ variable will be staying etc.

PHP CODE:

<?php
// Create a connection to your database. 
	  require_once ('connectPagehere.php'); // Connect to the db.
// Query database and select the last 10 entries.
$result = mysql_query("SELECT heading, DATE_FORMAT(date, ' %W %D %M %y') AS dr, news, link FROM news ORDER BY id DESC");

$text= '';
while($row = mysql_fetch_array($result))
{
$text.='<font face="Verdana, Arial, Helvetica, sans-serif" pointsize="3" color="#730683" size="14"><b>'.$row['heading'].'</b></font><br /><font color="#c38ecb" size="10">'.$row['dr'].'</font><br /><font color="#62226c" size="12">'.$row['news'].'</font><br /><font color="#ff0000" size="10"><a href="http://'.$row['link'].'">Read More . . .</a></font><br /><br />';
}
  echo 'content='.$text;
?>

the ’ content ’ is my variable in flash.

FLASH CODE:
This is simple a dynamic textbox with a variable name called content then the loading code as below:

theTextbox.loadVariables("http://www.site.co.uk/dataSheet.php", this, "POST");

well I hope I have made this understandable, and easy to fix…:slight_smile:

si

Well after a load of trials and errors and the good old interwebby searching etc I have come across a solution:

PHP first:
Basically I need to swop the ‘&’ in my links with the equivalent of ‘%26’. So i did a simple str_replace on the text at the end and swopped them all with the ‘%26’:

PHP CODE:

<?php
// Create a connection to your database. 
	  require_once ('connection.php'); // Connect to the db.
// Query database and select the last 10 entries.
$result = mysql_query("SELECT heading, DATE_FORMAT(date, ' %W %D %M %y') AS dr, news, link FROM news ORDER BY id DESC");

$text= '';
while($row = mysql_fetch_array($result))
{
$text.='<font face="Arial, Helvetica, sans-serif" color="#730683" size="14"><b>'.$row['heading'].'</b></font><br /><font face="Arial, Helvetica, sans-serif" color="#c38ecb" size="10">'.$row['dr'].'</font><br /><font face="Arial, Helvetica, sans-serif" color="#62226c" size="12">'.$row['news'].'</font><br /><b><font face="Arial, Helvetica, sans-serif" color="#ff0000" size="11"><a href="http://'.$row['link'].'">READ MORE . . .</a></font></b><br /><br />';
}

$newText = str_replace("&", "%26", $text);

  echo 'content='.$newText;
?>

The extra code I used was ’ [COLOR=“Red”]$newText = str_replace("&", “%26”, $text);[/COLOR]’

FLASH:
With flash I changed the way I load my text in, so I then had so will show all the code to make it easier:


theData = new LoadVars();
theData.onLoad = function(){
	   
	theText.myText_txt.htmlText =unescape(this.content);
   
};

theData.load(".....thetext.php");

stop();

baiscally change the coding so I can start to add css styling if needs be later on…

the only change here was to take the text box variable name out and give it a instance name instead.

and now flash transfers the %26 into the & sign, so my links show full

http://www.blah.com?para1=122&para2=232 instead of stopping as soon as I get to the first http://www.blah.com?para1=122

Si