title: Store 2 dimensional array from a SQL query
body: <pre><code>$query = "select id, name, email from users";
  $result = mysql_query($query) or die('Query failed: ' . mysql_error());
  $users = mysql_fetch_array($result, MYSQL_BOTH);
  </code></pre>
  
  <p>I did research on google, however, I didn't find a good answer.</p>
  
  <p>I am trying to store results from a SQL query in an 2 dimentional array that will contain all the users and then to use the array.</p>
  
  <p>mysql_fetch_array returns only 1 row and it's not helping me..</p>
  
  <p>In the attached image (table), for <code>$users[1][name]</code>  I want to receive "Bar" (assuming that the indicator starting in 0 and I want the second row).</p>
  
  <p>Example Table:</p>
  
  <p><a href="https://i.stack.imgur.com/3QbSR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3QbSR.png" alt="enter image description here"></a></p>
  
  <p>UPDATE:</p>
  
  <pre><code>$query = "select Traveler_Username,Traveler_First_Name from users";
  $result = mysql_query($query) or die('Query failed: ' . mysql_error());
  echo '&lt;table align="center" border="1" cellpadding="5" cellspacing="5" style="border-collapse: collapse; background-color: #FF66AE66"&gt;&lt;tr align="center"&gt;&lt;td&gt;&lt;b&gt;Username&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;First Name&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;/tr&gt;';
          while($first = mysql_fetch_array($result)){ 
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;".$first["Traveler_Username"]."&lt;/td&gt;";
              echo "&lt;td&gt;".$first["Traveler_First_Name"]."&lt;/td&gt;";
              echo "&lt;/tr&gt;";
          } // end While
  </code></pre>
  
  <p>This code make an output of the attached image. However, I still don't know how to use the content inside the array (like to store a name in another variable)..</p>
  
  <p><a href="https://i.stack.imgur.com/hH4Je.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hH4Je.png" alt="Example Image 1"></a></p>