# Flash+PHP image gallery/catalogue

**URL:** <https://forum.kirupa.com/t/flash-php-image-gallery-catalogue/184587>\
**Category:** flash\
**Created:** [April 6, 2006, 2:30am UTC](https://forum.kirupa.com/t/flash-php-image-gallery-catalogue/184587 "2006-04-06T02:30:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ya3](https://avatars.discourse-cdn.com/v4/letter/y/e95f7d/32.png) [@ya3](https://forum.kirupa.com/u/ya3)\
**Post date:** [April 6, 2006, 2:30am UTC](https://forum.kirupa.com/t/flash-php-image-gallery-catalogue/184587/1 "2006-04-06T02:30:09Z")

</div>

I need Flash to display a page of images and text (see attached sketch) dynamically loaded from the MySQL database, via PHP.

In my MySQL database, I’ve got:  
[COLOR=“DarkRed”][FONT=“Courier New”]id (auto increment)  
name  
artists  
date  
image[/FONT][/COLOR]

I can get the PHP file to output something like:  
[COLOR=“DarkRed”][FONT=“Courier New”]name2=Someone&artists2=Someone&date2=2006&name1=Someone&artists1=Someone&date1=2005[/FONT][/COLOR]

Problem is, I need an **efficient** and uncomplicated way to have Flash read these variables and put them into each textbox. I mean, I could fumble around with heaps of messy code to achieve the desired effect, but I’m sure there’s a nice, simple way of doing this.

Also, the items need to be displayed in **descending** order, according to the ‘id’.

Not too worried about the dynamically loaded images just yet… I just want to get the basic text loading worked out, and I’ll go from there.

I think all this has something to do with using ‘loops’ or something, but I’ve got no idea.

Thanks in advance!!

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 6, 2006, 4:11am UTC](https://forum.kirupa.com/t/flash-php-image-gallery-catalogue/184587/2 "2006-04-06T04:11:26Z")

</div>

yes it has to do with loops.

at the end of all your variables pass a &numberOfResults=11& or whatever - using that function in php that i forget -

then in flash use

```auto

for (i=1; i<=numberOfResults; i++) {
	//
	_root["textfield_mc"+i].name_textbox.text = _root["name"+i];
	_root["textfield_mc"+i].artist_textbox.text = _root["artist"+i];
	_root["textfield_mc"+i].year_textbox.text = _root["year"+i];
	//
}

```

to go thru and put the vars in the texfields…

or

```auto

for (i=numberOfResults; i>0; i--) {
	//
	_root["textfield_mc"+i].name_textbox.text = _root["name"+i];
	_root["textfield_mc"+i].artist_textbox.text = _root["artist"+i];
	_root["textfield_mc"+i].year_textbox.text = _root["year"+i];
	//
}

```

to start at the end and work backwards thru the results

---

<div class="post-metadata">

**Author:** ![ya3](https://avatars.discourse-cdn.com/v4/letter/y/e95f7d/32.png) [@ya3](https://forum.kirupa.com/u/ya3)\
**Post date:** [April 6, 2006, 10:26am UTC](https://forum.kirupa.com/t/flash-php-image-gallery-catalogue/184587/3 "2006-04-06T10:26:45Z")

</div>

You’re an absolute legend, buddy. Thanks :hugegrin:

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 6, 2006, 10:57am UTC](https://forum.kirupa.com/t/flash-php-image-gallery-catalogue/184587/4 "2006-04-06T10:57:55Z")

</div>

im surprised you been here so long and dont know loops?

---

<div class="post-metadata">

**Author:** ![ya3](https://avatars.discourse-cdn.com/v4/letter/y/e95f7d/32.png) [@ya3](https://forum.kirupa.com/u/ya3)\
**Post date:** [April 6, 2006, 12:10pm UTC](https://forum.kirupa.com/t/flash-php-image-gallery-catalogue/184587/5 "2006-04-06T12:10:32Z")

</div>

Older but none the wiser 😉

It’s just something I’ve never needed to look into, that’s all.
