0 Replies Latest reply on Nov 12, 2006 1:16 PM by angelpenalva

    loadvars Flash & MySQL query

    angelpenalva
      Can somebody help me to find a solution to this example?
      I'm working on a tutorial I found in Macromedia Flash Developer Center:
      This is the PHP Script that shows images and data stored in a MySQL database. I have modyfied it...



      <?php
      mysql_connect("localhost","root","");
      mysql_select_db("flashcms");

      $tab = $HTTP_POST_VARS['thisLetter'];
      $qr = mysql_query("SELECT * FROM press WHERE LEFT(magazine,1) = '".$tab."' ORDER BY date");


      // start output string with number of entries
      $nrows = mysql_num_rows($qr);
      $rString = "n=".$nrows;

      for ($i=0; $i < $nrows; $i++) {
      $row = mysql_fetch_array($qr);
      $rString .= "&magazine".$i."=".$row['magazine'] /*."&firstName".$i."=".$row['firstName'] */;
      $rString .= "&date".$i."=".$row['date'] /* ."&email".$i."=".$row['email']*/;
      $rString .= "&picFile".$i."=".$row['picFile']."&caption".$i."=".$row['caption'];
      }
      echo $rString;
      ?>


      /////////////////////////////////////////////////////


      In the actionScript frame I have got the following:

      function showjpg(paramString) {
      // get the individual parameters:
      // params[0] = picture file name
      // params[1] = caption
      var params = paramString.split("#");
      picHolder.loadMovie(params[0]);
      caption.text = unescape(params[1]);
      }
      function showContent() {
      var i;
      content.htmlText = "";
      for (i=0; i < this.n; i++) {
      if (this["picFile"+i] != "") {
      content.htmlText += "<b>" + this["magazine"+i] + " " + "</b>" + "<a href='asfunction:showjpg," + this["picFile"+i] + "#" + escape(this["caption"+i]) + "'>  (<font color='#0000cc'>pic</font>)</a><br>";
      } else {
      content.htmlText += "<b>" + this["magazine"+i] + " " + "</b><br>";
      }
      content.htmlText += "  " + this["date"+i] + "<br>";
      // content.htmlText += "  <a href='mailto:" + this["email"+i] + "'>" + this["email"+i] + "</a><br><br>";
      }
      }


      Everything's ok so far... but I'd like to show the query as soon as the movie loads - directly - instead of showing data according to the letter of the tab pressed.

      http://www.adobe.com/es/devnet/flash/articles/flashmx_php.html

      Thank you very much in advanced for your help.

      Kind regards.

      Angel