# God help me ! Dam PHP loop to Flash

**URL:** <https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269>\
**Category:** Uncategorized\
**Created:** [July 21, 2004, 3:23am UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269 "2004-07-21T03:23:22Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_Vulcan](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/the_vulcan/32/145_2.png) [@The\_Vulcan](https://forum.kirupa.com/u/The_Vulcan)\
**Post date:** [July 21, 2004, 3:23am UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/1 "2004-07-21T03:23:22Z")

</div>

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

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

```php
 
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 .'';
  
 $i++;
 
 }

```

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

```php
 
myEntries = new LoadVars() 
 myEntries.ref = this
 myEntries.load("GuestBook.php?action=read&r="+random(999)+"&NumLow="+_parent.NumLow) 
 myEntries.onLoad = function(success){ 
  if(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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 3:41am UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/2 "2004-07-21T03:41:19Z")

</div>

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. 🙂

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 3:54am UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/3 "2004-07-21T03:54:50Z")

</div>

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 !

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 3:59am UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/4 "2004-07-21T03:59:59Z")

</div>

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.

```php
 

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

```

I attach the file if you care to look.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 4:10am UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/5 "2004-07-21T04:10:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 4:15am UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/6 "2004-07-21T04:15:28Z")

</div>

Now all that shows up is “undefined”

If I take the loop away it sends  
Name  
Location  
Age  
Date  
Comment

to each of the 3 movies…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 4:16am UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/7 "2004-07-21T04:16:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 4:23am UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/8 "2004-07-21T04:23:44Z")

</div>

How do I get to see it ?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 4:30am UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/9 "2004-07-21T04:30:31Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 9:25am UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/10 "2004-07-21T09:25:41Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 11:17pm UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/11 "2004-07-21T23:17:16Z")

</div>

Hey **Yeldarb**

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

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. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 11:20pm UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/12 "2004-07-21T23:20:18Z")

</div>

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 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 11:33pm UTC](https://forum.kirupa.com/t/god-help-me-dam-php-loop-to-flash/58269/13 "2004-07-21T23:33:47Z")

</div>

Oh… well I did look into

sendAndLoad

but couldn’t figure it out…

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