title: Array from SQL and extract not working PHP
body: <p>I am brand new to PHP so thank you for your help. </p>
  
  <p>I am trying to get the contents of a certain row in an SQL table and put it into an array, then put each of the values into its own variable.</p>
  
  <p>I need them in both the array and in the variables for a few different reasons on the page. </p>
  
  <p>The table has three columns: student_id, first_name, and last_name</p>
  
  <p>I am using this code:</p>
  
  <pre><code>    $result = mysql_query("SELECT * FROM `students` WHERE student_id = '$studentid'",$connection);
  $array = array();
  while ($row = mysql_fetch_array($result)) {
      $array[] = array($row['student_id'], $row['last_name'], $row['first_name']);
  }
  extract($array);
  </code></pre>
  
  <p>But when I try to echo $last_name on the page, I get an undefined variable error. Am I using extract wrong? </p>
  
  <p>Any suggestions for accomplishing this?</p>
  
  <p>I know, I am using the old SQL not the mysqli, but I cannot change to it yet for a few reasons, so thank you for helping me with the old code.</p>
  
  <p>You're helping me learn to code!:) Thanks for helping me debug.</p>