I’m wanting the top 10 scores to display for a game I’m working on. I’m having trouble getting the information to display in a dynamic text box. I’ve been working on this for 2 days looking at examples and haven’t had any luck. I don’t know how to get more than one result to show in a dynamic text fields variable. I assume you can do it.
Right now I am getting it to display the very last name in my database. It seems like I’m close, but there needs to be some minor adjustments or something. Could someone give me a suggestion on how to fix this?
Here is my php:
<?php
//connect to database
$link = mysql_connect(localhost, username, password)
or die("<b>error</b>: failed to connect to database");
//select the name column
$query = "SELECT name FROM coas.safety_scores";
$result = mysql_query($query)
or die("<b>error</b>: failed to execute query <i>$query</i>");
//print names to flash dynamic textbox variable, timer
while ($desiredContent = mysql_fetch_array($result))
{
$name=$desiredContent['name'];
print "&timer=".$name;
}
?>
Here is the actionscript:
onClipEvent (load) {
var preVars = new LoadVars();
preVars.action = 'preview';
preVars.sendAndLoad("http://coastal/process_scores.php", preVars, 'GET');
preVars.onLoad = function() {
_root.movie.score.text = this.timer;
};
}