# Dynamically loading MySQL data into text field

**URL:** <https://forum.kirupa.com/t/dynamically-loading-mysql-data-into-text-field/190482>\
**Category:** flash\
**Created:** [June 12, 2006, 9:24am UTC](https://forum.kirupa.com/t/dynamically-loading-mysql-data-into-text-field/190482 "2006-06-12T09:24:42Z")\
**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/190482/1 "2006-06-12T09:24:42Z")

</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")or die("<h2>There was a problem connecting to the database. Try again later.
 Alternativly, go to Namik's myspace account.</h2>
 <p><a href='http://www.myspace.com/namik'>Click here to go to myspace.</a>"); 
 mysql_select_db("$database")or die("cannot select DB");
 $sql = "SELECT * FROM news order by date DESC LIMIT 10";
 $result = mysql_query($sql) or die('Database error: ' . mysql_error());

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

Thansk
