title: Get values of a php in AS3
body: <p>I've managed to get a value from a sql table in my AS3 code, but I don't understand why I can't get a second value. </p>
  
  <p>In my php file I've got :</p>
  
  <pre><code>// create SQL
   $sql = "SELECT * FROM dt_base where username = '$username'";
  
  // execute SQL query and get result
   $sql_result = mysql_query($sql, $connection) or die ("Couldn't execute query.");
  
  // get number of rows in $result.
   $num = mysql_numrows($sql_result);
  
  $phpConfirm = "";
  $phpConfirmSecond = "";
  $counter = 0;
  
  while ($row = mysql_fetch_array($sql_result)) {
  
   $up= $row["up"];
   $down= $row["down"];
   if ($counter == 0) {
   $phpConfirm .= $up;
   $phpConfirmSecond .= $down;
  
   } else {
   // Use a item limiter "|" to seperate the records
   $phpConfirm .= "|" . $up;
   $phpConfirmSecond .= "|" . $down;
   }
   $counter++;
   }
  ?&gt; 
  </code></pre>
  
  <p>And in my AS3 code : </p>
  
  <pre><code>function loadComplete(evt:Event):void {
  
      //Display the value with variable name "totalItem"
      total_txt.text = evt.target.data.totalItem
  
      //Get the value (string) with variable name "phpConfirm"
      var myResult:String = evt.target.data.phpConfirm;
      trace(evt.target.data.phpConfirm);
  
      var myResultSecond:String = evt.target.data.phpConfirmSecond;
      trace(evt.target.data.phpConfirmSecond);
  
  
  //Split the string into an Array
      var myArray:Array = myResult.split("|");
      var myArraySecond:Array = myResultSecond.split("|");
  
      var finalString = "";
      var finalStringSecond = "";
      var i:int;
  
      for (i = 0; i &lt; myArray.length; i++) {
  
          finalString = finalString + myArray[i] + "&lt;br&gt;";
          finalStringSecond = finalStringSecond + myArraySecond[i] + "&lt;br&gt;";
      }
  
      output_txt.htmlText = finalString;
      output_txtSecond.htmlText = finalStringSecond;
  }
  </code></pre>
  
  <p><code>trace(evt.target.data.phpConfirm)</code> results with the value of "up", so it's working.
  But <code>trace(evt.target.data.phpConfirmSecond)</code> results with "undefined" instead of the value of "down".</p>
  
  <h2>Any idea why ?</h2>
  
  <p><strong>EDIT</strong></p>
  
  <p>I've add that to my php file. </p>
  
  <pre><code>echo "phpConfirm=" . $phpConfirm . "&amp;phpConfirmSecond=" . $phpConfirmSecond;
  </code></pre>
  
  <p>and I've change the line <code>$username = "John";</code> in order to test it in the web browser. </p>
  
  <p>The result is :</p>
  
  <p>phpConfirm=6h20&amp;phpConfirmSecond=14h32</p>
  
  <p>So phpConfirmSecond has a value.</p>
  
  <p>But my AS3 code produce an error when I had the PhpConfirmSecond in my php file. 
  Here's the error : </p>
  
  <pre><code>TypeError: Error #2007: Le paramètre text ne doit pas être nul.
      at flash.text::TextField/set text()
      at as3_php_mysql_01_fla::MainTimeline/loadComplete()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at flash.net::URLLoader/onComplete() 
  </code></pre>
  
  <p>If I erase every trace of PhpConfirmSecond of my php file, my AS3 code works and find the value PhpConfirm.</p>