Current location: Hot Scripts Forums » General Web Coding » Flash & ActionScript » loading dynamic data into flash


loading dynamic data into flash

Reply
  #1 (permalink)  
Old 03-02-08, 07:32 AM
nuttycoder nuttycoder is offline
New Member
 
Join Date: Mar 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy loading dynamic data into flash

I have managed to get some data from a mysql database into flash the problem is I can only get one row when I know there is three rows.

here's my actionscript:

This is on the frame so it loads the data as soon as you enter it

Code:
loadVariables("news.php", "POST");
My php script to get the data from the database

PHP Code:

query "SELECT * FROM flash_news";

$result mysql_query($query) or die('Error : ' mysql_error());

while(
$row mysql_fetch_array($result)){        


    
$row['newsTitle'] = stripslashes($row['newsTitle']);
    
$row['newsCont'] = stripslashes($row['newsCont']);

    
echo 
"&mynews=<b>Title</b>: " $row['newsTitle'] . "<br><b>Cont</b>: " $row['newsCont'];


Anyone know why I can only get 1 row when there is more rows?
Reply With Quote
  #2 (permalink)  
Old 03-02-08, 08:38 AM
hinch hinch is offline
Wannabe Coder
 
Join Date: Oct 2004
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Are you sure your text box is set to wrap? I make that mistake sometimes, thinking something isn't working when really it's just off the screen.
Reply With Quote
  #3 (permalink)  
Old 03-03-08, 04:21 AM
nuttycoder nuttycoder is offline
New Member
 
Join Date: Mar 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Wish that was it cos then it would be fixed

I have my text box set to Multiline so it will wrap even if it wasen't I have set the render text as HTML checked so its goes on to the next line after each title or content is echoed out using the <br> tag.

I think its something to do with it's only reading the latest result but not getting all the loops from php inside the while loop but this is just a guess.
Reply With Quote
  #4 (permalink)  
Old 03-03-08, 12:58 PM
hinch hinch is offline
Wannabe Coder
 
Join Date: Oct 2004
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Code:


<?php
$result 
mysql_query("SELECT * FROM flash_news LIMIT=1"
or die 
"<h2>Could not select config</h2>";

while(
$row mysql_fetch_array($result)) {

        
$title $row['newsTitle'];
        
$content $row['newsCont'];

echo
"<h1>Title: $title</h1>\n <br /> Cont: $content \n";
}
?>
That will list the most recent content in your table (depending how it's set, you may need to sort it using 'ORDER by'). It's probably better using 'WHERE' than 'LIMIT' also but that's up to you.

Does your PHP file work correctly on it's own? Is it tested outside of Flash?

Last edited by hinch; 03-03-08 at 01:01 PM.
Reply With Quote
  #5 (permalink)  
Old 03-04-08, 03:46 AM
nuttycoder nuttycoder is offline
New Member
 
Join Date: Mar 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
I don't want to limit the results I want to see all records in the table. I''ve tested the php file in a browser and it works fine but not in flash its almost like its not looping when it goes into flash.
Reply With Quote
  #6 (permalink)  
Old 03-04-08, 12:47 PM
hinch hinch is offline
Wannabe Coder
 
Join Date: Oct 2004
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Maybe you could zip and upload your code so far for someone to look at. It's a while since I did the same.

What version of Flash are you using? Try exporting it with different action script settings, it can be a great way to find some dodgy code sometimes.
Reply With Quote
  #7 (permalink)  
Old 03-05-08, 07:14 AM
blinn_shade's Avatar
blinn_shade blinn_shade is offline
Aspiring Coder
 
Join Date: Aug 2007
Posts: 540
Thanks: 0
Thanked 0 Times in 0 Posts
What happens when you visit the news.php file? Can you paste what you see please.
__________________
Can you think outside the box but remain inside the box?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
does dynamic flash image display consume bandwidth? janicefernandes Flash & ActionScript 1 12-29-07 08:38 AM
Need Your HelP! Loading Multiple External Text into Multiple Dynamic Text Fields Flash_Boi Flash & ActionScript 2 03-30-06 03:27 PM


All times are GMT -5. The time now is 06:37 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.