# Newbie Question About Getting Quotes from a Database (PHP/MX2004) - long post

**URL:** <https://forum.kirupa.com/t/newbie-question-about-getting-quotes-from-a-database-php-mx2004-long-post/121879>\
**Category:** Uncategorized\
**Created:** [September 8, 2004, 7:47am UTC](https://forum.kirupa.com/t/newbie-question-about-getting-quotes-from-a-database-php-mx2004-long-post/121879 "2004-09-08T07:47:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Northchild](https://avatars.discourse-cdn.com/v4/letter/n/ecccb3/32.png) [@Northchild](https://forum.kirupa.com/u/Northchild)\
**Post date:** [September 8, 2004, 7:47am UTC](https://forum.kirupa.com/t/newbie-question-about-getting-quotes-from-a-database-php-mx2004-long-post/121879/1 "2004-09-08T07:47:05Z")

</div>

Hi all,

This is my first time integrating PHP with Flash, and I’m a bit unsure of myself. I’m using MX2004 and have PHP with MySQL support on a remote server. Overall, I’m trying to get a simple “random quote of the day” thing working.

In the MySQL database, I have a table called quotes. This table has a field called allQuotes. allQuotes has 12 records with random semi-funny stuff that I’ve found on the web.

I have a FLA file with a movie clip with the instance name mcQuote. The movie clip contains one dynamic text field named txtQuote.

On a frame on the main timeline I have the following code:

```auto

_root.mcQuote.onLoad = function()
 
{
loadVariables("[https://www.drunkentrolls.com/read.php?file=quotes.php](https://www.drunkentrolls.com/read.php?file=quotes.php)", "_root.mcQuote", "POST");
}

```

On the server, the file quotes.php contains this code:

```auto

 
<?php
 
print "_root.mcQuote.txtQuote=$myQuote";
 
?>

```

On the server, the file read.php contains this code:

```auto

<?php
 
if($file)
 
{
$link = mysql_connect(edited, edited, edited)
	 or die("Failed to connect to database.");
 
$query = "SELECT content FROM files WHERE filename='$quote.php'";
$result = mysql_query($query) 
	 or die("Failed to execute query.");
 
mysql_close($link);
 
$myQuote = mysql_fetch_array($result, MYSQL_ASSOC);
 
mysql_free_result($result);
 
print "txtQuote=$myQuote";
}
?>

```

Now, if I upload all of this to the server, it’s not going to work because I’m an artist and these programming things never, ever work for me when I first try them. Also, I don’t anticipate getting the php to pick out a random quote and sending it to the flash player anytime this week. I would settle for getting ANY ONE field from this table printed out in the dynamic text file. Any hand-holding would be sooooo appreciated at this point.
