God help me ! Dam PHP loop to Flash

I hope someone can help me because I am about to give up.

[color=blue]This is the PHP loop.[/color]

if($numallComments == 0) { print "	   No entries yet.."; }
else {   while ($array = mysql_fetch_array($fewComments)) {
print "&writename[$i]=";	   $name   = mysql_result($fewComments, $i, 'name');		 print''. $name .'';
print "&writelocation[$i]=";   $location  = mysql_result($fewComments, $i, 'location');	print'<b>Location: </b><br>'. $location .'';
print "&writeage[$i]=";	 $dob   = mysql_result($fewComments, $i, 'dob');
			 $today	 = date("Y"); 
			 $dob	   = $today - $dob;				 print'<b>Age: </b>'. $dob .'';
print "&writedate[$i]=";	$time   = mysql_result($fewComments, $i, 'time');
			 $time   = date("d-m-Y");			 print'<b>Date: </b>'. $time .'';
print "&writecomments[$i]=";   $comments  = mysql_result($fewComments, $i, 'comments');    print'<b>Commnets: </b><br>'. $comments .'';

[color=blue]This is the Flash recieve and paste to duplicated movies.[/color]

myEntries = new LoadVars() 
 myEntries.ref = this
 myEntries.onLoad = function(success){ 
ring.writename.text = this.writename;	  
ring.writeage.text = this.writeage;		  
ring.writedate.text = this.writedate;		  
ring.writelocation.text = this.writelocation; 
ring.writecomments.text = this.writecomments; 
for(i=0; i<3; i++){
eval("ring"+i).writename.text = this.eval("writename"+i);
eval("ring"+i).writeage.text = this.eval("writeage"+i);		
eval("ring"+i).writedate.text = this.eval("writedate"+i);
eval("ring"+i).writecomments.text = this.eval("writecomments"+i);

All I get is “Undefined

I guess the error is in;
A. the loop in PHP is not reading the data as I think it is.
B. Flash in not recieving the data for some reason.

I hope someone can help me with this :slight_smile:

I haven’t looked through all of your code, but one thing that I noticed was that you start off the first thing in your loop with &. You should put a dummy entry in before hand (before the loop) without the & in front of it so that it starts out as variable1=stuff instead of &variable1=stuff

try it, and if it doesn’t work, i’ll delve (is that a word?) further into your code. :slight_smile:

edit: Your mysql queries appear like they need some work, but I’m not sure exactly what you’re trying to achieve with them. You might want to hard code some values in to test, and see what it returns.

I am not sure what you mean, I am a real PHP noob.

The loop was working, but it pulled 10 entries out and sent them to flash as one item (notepad style).
Now that I have modified the code, and created the duplicate movies in flash but it wont work.

I have been at this since 6pm yesterday, and it is now 1:23pm, my thinking is a little off but I am determind to get this to work before I sleep !

I could pull out one entry with this and send it to all the movies fine.
But as soon as I try to pull out more than one it dies.


print "&writename=";	   $name   = mysql_result($fewComments, $i, 'name');		 print''. $name .'';

I attach the file if you care to look.

What does it prind out (the php)
Try having flash open the php in a new window and then copy and paste what it displays. I have a feeling that it’s with the way the text is formatted. Honestly, I wouldn’t have done the whole 3 lines in one thing, I would have done the $name=whatever; then on a new line have print “&writename=$name”

Your way should work if it is formatted correctly though.

Now all that shows up is “undefined”

If I take the loop away it sends

to each of the 3 movies…

No, i mean with your loop, what is the exact thing that the php outputs? Like &variable1=blah&variable2=stuff etc.

How do I get to see it ?

try commenting out the send line you are using, and making a new line with sendAndLoad opening a _blank window. (I don’t remember the exact syntax, so you may have to look it up in the Actionscript Dictionary).

Well I took a 3 hour nap…

My brain felt like I was drunk, just couldn’t think straight…
But that’s what you get for sleeping 6 hours in 4 days (3 hours every second day).

So back to this dam loop that will be the death of me…

Hey Yeldarb

Well I missed going to bed again, but I think my body is getting used to no sleep now. :slight_smile:

Anyway yesterday when you where telling me what to do I was so far out of it didn’t know what was going on.

I couldn’t trace it because I didn’t have a local server set up.

last night I set up ISS, PHP, mySQL local but i can’t get phpMyAdmin to work.

I just posted here asking a question on that…

Yeah I can create tables from DOS, or load a text file, but I would rather get MyAdmin to work than stuff around with that. :slight_smile:

Wait, what? Why can’t you trace it? All I meant was just having it open a new browser window that would display what your php returned :wink:

Oh… well I did look into


but couldn’t figure it out…

I have myAdmin working now so I should be able to trace it in a minute, fingures crossed.