1 Reply Latest reply on Mar 11, 2008 8:12 AM by Newsgroup_User

    [f8] mysql + flash

      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:
      //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))
      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;

        • 1. Re: [f8] mysql + flash
          Level 7
          jay0316 wrote:
          > print "&timer=".$name;

          You should add numbers to the variable name otherwise you will always
          get only the last item. Do the same in AS and you may also add a
          helpvaraible like 'max' so you will know how many items you get. Or you
          just loop until the 'timer9' will be undefind - or just count to 8 :-)