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:
_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:
<?php
print "_root.mcQuote.txtQuote=$myQuote";
?>
On the server, the file read.php contains this code:
<?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.