dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [mx04]

  1. #1
    Senior Member
    Join Date
    Aug 2004
    Location
    plymouth-uk
    Posts
    313

    [mx04]

    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:
    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:
    Code:
    theTextbox.loadVariables("http://www.site.co.uk/dataSheet.php", this, "POST");
    well I hope I have made this understandable, and easy to fix...:-)

    si
    NOW! look whats happened! I told you to watch this space and now its gone.

  2. #2
    Senior Member
    Join Date
    Aug 2004
    Location
    plymouth-uk
    Posts
    313
    firstly appologise for the lack of title..don't know where that went.

    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:
    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 ' $newText = str_replace("&", "%26", $text);'

    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:

    Code:
    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
    NOW! look whats happened! I told you to watch this space and now its gone.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center