Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 20th, 2001, 11:54 AM
alligatorTim alligatorTim is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 46 alligatorTim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 55 m 18 sec
Reputation Power: 13
multiple rows from DB to php to flash

has anyone here ever had any experience pulling multiple rows from a table in a DB with php and then passing those to a flash file via loadvariables().

i can get one row no problem, but not multiple rows. i've tried just about everything. passing arrays, dynamic variable names... i'm stumped.

Reply With Quote
  #2  
Old December 24th, 2001, 05:19 PM
JeffCT JeffCT is offline
Dev
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2001
Posts: 1,436 JeffCT User rank is Sergeant Major (2000 - 5000 Reputation Level)JeffCT User rank is Sergeant Major (2000 - 5000 Reputation Level)JeffCT User rank is Sergeant Major (2000 - 5000 Reputation Level)JeffCT User rank is Sergeant Major (2000 - 5000 Reputation Level)JeffCT User rank is Sergeant Major (2000 - 5000 Reputation Level)JeffCT User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 h 52 m 59 sec
Reputation Power: 40
I don't see anythign preventing you from sending multiple rows, just number them in some way. Put all the data for the first row in vars like this:

var1_1
var2_1
var3_1

etc.

No reason you can't do that. It's a cheesy workaround but that's Flash for you. You could also try XML but I don't like the way XML is so bulky and not space efficient, and I try to keep my Flash+PHP programs as tight and efficient as possible.

Reply With Quote
  #3  
Old December 31st, 2001, 11:45 AM
mbritton72 mbritton72 is offline
Shrill Digital God
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Raleigh, NC
Posts: 64 mbritton72 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m
Reputation Power: 12
incremented name/value pairs

In PHP:

<?

// Query stuff here


$current_row = 1;

while ($fetch = mysql_fetch_array($result)) { echo "&varName".$current_row."=".$fetch["fieldName"]."";
$current_row++;
}

echo "&loaded=1";

?>


In Flash Actionscript:

count = 0;
index = 1;

loadVariables ("php_template.php", "", "POST");

// Then, with the text field named flashVarName, on a keyframe:

flashVarName = varName1;

// Now make buttons to advance / back up in this fashion:

on (press) {
if (Number(index) < Number(count)) {
index = Number(index)+1;
} else {
index = 1;
}
flashVarName= eval("varName" add index);
}
__________________
I'm not impatient, I just have a low tolerance for boredom.

Reply With Quote
  #4  
Old December 31st, 2001, 01:01 PM
alligatorTim alligatorTim is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 46 alligatorTim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 55 m 18 sec
Reputation Power: 13
thanks very much for the suggestions. i need the rows displayed in flash in a list format. i can pass say the first 20 rows like you guys mentioned and then create 20 different movie clips all with different but corresponding variable names. but how do i stop a longer row from wrapping and then overlapping the following movie clip.

is there a way to dynamically create these movie clips depending on the variables it gets from your php script so i don't have to create 20 movie clips?

-alligator

Reply With Quote
  #5  
Old December 31st, 2001, 01:51 PM
mbritton72 mbritton72 is offline
Shrill Digital God
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Raleigh, NC
Posts: 64 mbritton72 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m
Reputation Power: 12
something like this

This scenario if you have already loaded your incremented name/value pairs (see my previous example):

In Flash Actionscript

// Declare your variables

x = 1;
position = 0;

while (x <= _root.numberRows) {

// "post"+x being each duplicated clip's new name:

duplicateMovieClip ("_root.movieClip", "post"+x, x);
setProperty ("_root.post"+x, _y, position);
this["post"+x].clip1 = _root.["clip1"+x];
position = position+64;
x = x+1;
}

Reply With Quote
  #6  
Old December 31st, 2001, 05:15 PM
alligatorTim alligatorTim is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 46 alligatorTim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 55 m 18 sec
Reputation Power: 13
okay so first i tried cutting your action script into flash 5 but i got syntax errors i couldn't figure out, and it wouldn't let me switch back to normal mode, so then i tried to break apart your post and recreate my own example. clearly i still don't understand some things.

in php4flash_temp.php:

PHP Code:
<?
include("dbconnect_yank.php");
$query "select topic from topics order by date desc";
$result mysql_result($query);
$row mysql_fetch_row($result);

print 
"num_rows=" mysql_num_rows($result);
$x 1;
while (
$row) {
        print 
"value_" $x "=" $row[0];
        
$x $x 1;
        
$row mysql_fetch_row($result);
}
print 
"&loaded=1";
?>


i'm not sure what the variable "&loaded" is supposed to be for yet...

in flash on the main timeline keyframe one there is an instance of a movie clip called "db_text". in it there is a dynamic text field with the variable name "flash_var_name".

also on keyframe one of the main timeline there is the fallowing action script:

count = 1;
position = 0;
loadVariablesNum ("php4flash_temp.php", 0, "POST");

then on keyframe two of the main timeline there is this:

while (count <= num_rows) {
duplicateMovieClip ("db_text", "dup"+count, count);
setProperty ("this.dup"+count, _y, position);
set ("this.dup"+count+".flash_var_name", "value_"+count);
position = position + 64;
count = count + 1;
}
stop ();

am i close???

Last edited by alligatorTim : December 31st, 2001 at 05:18 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > multiple rows from DB to php to flash

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap