title: How to convert PHP mysql_fetch_array() into NSMutableArray? PHP --> Xcode
body: <p>I'm trying to read an entire row from <strong>mysql</strong> into a <code>NSMutableArray</code> using <strong>PHP</strong>.</p>
  
  <p>Example <strong>PHP</strong> Code</p>
  
  <pre><code>&lt;?php
  $con = mysql_connect("localhost", "username", "password");
  if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
  
  $db_selected = mysql_select_db("test_db",$con);
  $sql = "SELECT * from Person WHERE Lastname='smith'";
  $result = mysql_query($sql,$con);
  echo(mysql_fetch_array($result));
  
  mysql_close($con);
  ?&gt;
  </code></pre>
  
  <p>The output of the array above could be:</p>
  
  <pre><code>Array
  (
  [0] =&gt; smith
  [LastName] =&gt; smith
  [1] =&gt; Adam
  [FirstName] =&gt; Adam
  [2] =&gt; California
  [Address] =&gt; California
  [3] =&gt; 22
  [Age] =&gt; 22
  )
  </code></pre>
  
  <p>How do I read that array from <strong>mysql</strong>, and store that as a <code>NSMutableArray</code>?</p>
  
  <p>So far, I only know how to receive a string from <strong>PHP</strong> using the following:</p>
  
  <pre><code>//to execute php code
  NSData *dataURL = [NSData dataWithContentsOfURL: [NSURL URLWithString:strURL]];
  
  //to receive the returned value
  NSString *strResult = [[NSString alloc] initWithData:dataURL encoding: NSUTF8StringEncoding];
  </code></pre>
  
  <p>But I don't know how to read an array and convert that into a <code>NSMutableArray</code>. I spent hours searching and I cannot find an answer. I would prefer not to use <strong>JSON</strong> and stick with <code>Mysql/PHP/Obj-c</code>.</p>