title: Swift: Get JSON array value from MYSQL using Alamofire
body: <p>I am developing a system project. How to display 3 column value from MySQL to 3 UILabel(1. nameLabel.text, 2. idnumberLabel.text, 3. statusLabel.text) using Alamofire.</p>
  
  <p>PHP Code xxxx.php:</p>
  
  <pre><code> if ($_GET) {
          $idnumber = $_GET['idnumber'];
  
          // get a product from products table
          $stmt = $pdo-&gt;prepare("SELECT * FROM register WHERE idnumber = :idnumber");
          $stmt-&gt;execute(array(":idnumber" =&gt; $idnumber));
          $result = $stmt-&gt;fetch();
  
          if (!empty($result)) {
              // check for empty result
              if ($stmt-&gt;rowCount() &gt; 0) {
  
                  $user = array();
                  $user["name"] = $result["name"];
                  $user["idnumber"] = $result["idnumber"];
                  $user["status"] = $result["status"];
                  // success
                  $response["success"] = 1;
  
                  // user node
                  $response["user"] = array();
  
                  array_push($response["user"], $user);
  
                  // echoing JSON response
                  echo json_encode($response);
              } else {
                  // no product found
                  $response["success"] = 0;
                  $response["error_message"] = "Not registered user";
  
                  // echo no users JSON
                  echo json_encode($response);
              }
          } else {
              // no product found
              $response["success"] = 0;
              $response["error_message"] = "No user found";
  
              // echo no users JSON
              echo json_encode($response);
          }
      } else {
          // required field is missing
          $response["success"] = 0;
          $response["error_message"] = "Required field(s) is missing";
  
          // echoing JSON response
          echo json_encode($response);
      }
  </code></pre>
  
  <p>this is the link to find user by id number <strong><a href="http://localhost/xxxx.php/idnumber=" rel="nofollow">http://localhost/xxxx.php/idnumber=</a>?</strong>
  I want to use UITextfield to execute the <strong>idnumber</strong>.</p>
  
  <p>JSON encode</p>
  
  <pre><code>  {"success":1,"user":[{"name":"PETER JENSEN","idnumber":"35433332","status":"PROCESS"}]}
  </code></pre>
  
  <p>Swift Code:</p>
  
  <pre><code> @IBAction func CheckUserStatusTapped(sender: UIButton) {
          var idnumber = self.idnumberTextField.text
          let prefs:NSUserDefaults = NSUserDefaults.standardUserDefaults()
          let parameters =
              ["idnumber": idnumber]
  
          //load and parse the JSON into an array
          Alamofire.request(.POST, "http://localhost/xxxx.php", parameters: parameters).responseJSON { (request, response, data, error) in
  
                   var name = jsonResult [0]["name"]
              var idnumber = jsonResult [0]["idnumber"]
              var status = jsonResult [0]["status"]
  
          }
      }
  </code></pre>
  
  <p>I tried this but it got nothing and error. I dont know to display this value to the UILabel.Please help me :(. Im so confuse. Sorry for my bad english!</p>