# Populate Flash Dynamic Text Fields From PHP server

**URL:** <https://forum.kirupa.com/t/populate-flash-dynamic-text-fields-from-php-server/322840>\
**Category:** flash\
**Created:** [June 5, 2011, 1:30pm UTC](https://forum.kirupa.com/t/populate-flash-dynamic-text-fields-from-php-server/322840 "2011-06-05T13:30:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheWayWeWere](https://avatars.discourse-cdn.com/v4/letter/t/e495f1/32.png) [@TheWayWeWere](https://forum.kirupa.com/u/TheWayWeWere)\
**Post date:** [June 5, 2011, 1:30pm UTC](https://forum.kirupa.com/t/populate-flash-dynamic-text-fields-from-php-server/322840/1 "2011-06-05T13:30:21Z")

</div>

[COLOR=black][SIZE=3][FONT=Calibri]I need help with the PHP script that will populate my flash fields.[/FONT][/SIZE][/COLOR]  
[COLOR=black][/COLOR]  
[COLOR=black][SIZE=3][FONT=Calibri]I connect to the database okay. I am having a problem populating my flash dynamic text fields. It’s a flash form with 7 dynamic text fields. I want to connect to the mysql database and bring to the flash form those fields in my form. There are over 100 rows so I want to be able to show one record on the form, then click a next button to show the next record.[/FONT][/SIZE][/COLOR]  
[SIZE=3][FONT=Calibri][COLOR=black]The[/COLOR] print “content=$desiredContent[facct]”; gives me a blank. If I change it to the name on the database print “content=$desiredContent[AccountNumber]”; The account number is printed out which is what I want, but how to get it to show in my flash form and flash will know to attach Account Number to my dynamic field names Facct?[/FONT][/SIZE]  
[FONT=Calibri][SIZE=3] [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]I will need to do this for several dynamic fields. The table has 100 records that I want to push to the flash form with a control of next to see the next record. When I run my flash swf that reads the PHP file on my server, the form opens blank. Please help.[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] [/SIZE][/FONT]  
[COLOR=black][FONT=Calibri][SIZE=3] [/SIZE][/FONT][/COLOR]  
[COLOR=black][SIZE=3][FONT=Calibri]In my movie clip I have:[/FONT][/SIZE][/COLOR]  
[COLOR=black][FONT=Calibri][SIZE=3] [/SIZE][/FONT][/COLOR]  
[COLOR=black][SIZE=3][FONT=Calibri]onClipEvent (load) {[/FONT][/SIZE][/COLOR]  
[COLOR=black][FONT=Calibri][SIZE=3]loadVariables("[/SIZE][/FONT][[FONT=Calibri][SIZE=3][COLOR=#0000ff]http://www.xyz.org/testdata.php[/COLOR][/SIZE][/FONT]](http://www.xyz.org/testdata.php)[SIZE=3][FONT=Calibri]", this, “GET”);[/FONT][/SIZE][/COLOR]  
[COLOR=black][SIZE=3][FONT=Calibri]}[/FONT][/SIZE][/COLOR]  
[COLOR=black][FONT=Calibri][SIZE=3] [/SIZE][/FONT][/COLOR]  
[COLOR=black][SIZE=3][FONT=Calibri]In my php file on my server I have:[/FONT][/SIZE][/COLOR]  
[COLOR=black][FONT=Calibri][SIZE=3] [/SIZE][/FONT][/COLOR]  
[FONT=Calibri][SIZE=3]\<?php[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]//Make a MySQL Connection[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]$connection = mysql\_connect(“localhost”, “xyz”, “pswd”) or die(mysql\_error());[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]mysql\_select\_db(“xyz\_database”) or die(mysql\_error());[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] echo “Connected to Database\<br /\>”; [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]//$query = ‘SELECT \* FROM account’;[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]//$results = mysql\_query($query);[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]////test to get accountnumber from the database[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] $query = “SELECT AccoutNumber FROM account”;[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] $result = mysql\_query($query) [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] or die("\<b\>error\</b\>: failed to execute query \<i\>$query\</i\>");[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] $desiredContent = mysql\_fetch\_array($result, MYSQL\_ASSOC);[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] mysql\_free\_result($result);[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]//facct is the name of my dynamic text field [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] print “content=$desiredContent[facct]”;[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]//close connection[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] mysql\_close($connection);[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]?\>[/SIZE][/FONT]

Please help.  
TheWayWeWere
