title: Assigning PHP Variable to MySQL Array
body: <p>I know there is a simple answer but I can't seem to put this together.  I am successfully pulling an array from a MySQL table in the following code, but I would like to assign individual PHP variables to each item.  </p>
  
  <pre><code>&lt;?php
  $con = mysql_connect("$hostname","$username","$password");
  if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
  
  mysql_select_db("$database", $con);
  
  $result = mysql_query("SELECT * FROM table WHERE state=1");
  
  while($row = mysql_fetch_array($result))
    {
    $value=$row['id'];
    }
  
  mysql_close($con);
  ?&gt;
  </code></pre>
  
  <p>When I run this loop I get the output of the id's as 1,2,3,4,5,6,7.  How can I go about assigning individual PHP variables to each of these values?</p>