title: How to select certain fields from table in mySQL using PHP
body: <p>I'm trying out my hand at php at the moment - I'm very new to it!</p>
  
  <p>I was wondering how you would go about selecting all items from a mySQL table (Using a SELECT * FROM .... query) to put all data into an array but then not displaying the data in a table form. Instead, using the extracted data in different areas of a web page. </p>
  
  <p>For example:</p>
  
  <p>I would like the name, DOB and favorite fruit to appear in one area where there is already say 'SAINSBURYS' section hardcoded into the page. Then further down the next row that is applicable to 'ASDA' to appear below that.</p>
  
  <p>I searched both here and google and cant seem to find an answer to my strange questions! Would this involve running the query multiple times filtering out the sainsburies data and the asda data where ever I wanted to place the relevant </p>
  
  <pre><code>   echo $row['name']." ";
     echo $row['DOB']." "; etc etc
  </code></pre>
  
  <p>next to where it should go?</p>
  
  <p>I have got php to include data into an array (I think?!)</p>
  
  <pre><code>$query = "SELECT * FROM people"; 
  
  $result = mysql_query($query) or die(mysql_error());
  
  $row = mysql_fetch_array($result) or die(mysql_error());
  
  while($row = mysql_fetch_assoc($result))
  {
     echo $row['name']." ";
     echo $row['DOB']." ";
     echo $row['Fruit']." ";
  }
  
  ?&gt;
  </code></pre>