# Dynamically loading MySQL data into text field

**URL:** <https://forum.kirupa.com/t/dynamically-loading-mysql-data-into-text-field/190483>\
**Category:** Uncategorized\
**Created:** [June 12, 2006, 9:24am UTC](https://forum.kirupa.com/t/dynamically-loading-mysql-data-into-text-field/190483 "2006-06-12T09:24:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dopemac](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@Dopemac](https://forum.kirupa.com/u/Dopemac)\
**Post date:** [June 12, 2006, 9:24am UTC](https://forum.kirupa.com/t/dynamically-loading-mysql-data-into-text-field/190483/1 "2006-06-12T09:24:43Z")

</div>

Ok, I know this has been covered countless times but regardless of the numerous tutorials, posts etc. that I read I cannot get flash to read in my mysql data. I can make it read in a simple variable i.e.

```php
$x = "abc";
print "varname=$x";

```

… but as soon as I add anything else into it, it fails. Even just addign the mysql connect lines infront of what I have there will cause it to fall over.  
What I need is basically how to code the following PHP script and the action script (or even an explanation of how to alter it).

```php
 
mysql_connect("$host", "$user", "$password");
mysql_select_db("$database");
$sql = "SELECT * FROM news order by date DESC LIMIT 10";
$result = mysql_query($sql);
 
$anc = 1;
while ($newArray = mysql_fetch_array($result)) {
 
$id = $newArray['id'];
$news = stripslashes($newArray['news']);
$date = $newArray['date'];
$head = stripslashes($newArray['head']);
$date = date("d/m/Y", strtotime($date));
print" ***$date and $news should be printed here***"
++$anc;
}

```

Honestly try as I might, I cannot get this to display.

Thanks in advance  
Graham
