title: How to put sql query result into an array?
body: <p>I want to put a sql query result into an array.
  I tried the code below but it shows the 1st record for $count times.
  Obviously it's something wrong at the "$dept[$i]= $row['name'];".
  But i have no idea how to fix it.
  Somebody help please?</p>
  
  <pre><code>$sql="SELECT name FROM system_dept ORDER BY id";
  $result=mysql_query($sql);
  $row = mysql_fetch_array($result);
  $count=mysql_num_rows($result);
  if (!mysql_query($sql,$con))
  {
      die('Error: ' . mysql_error());
  }
  else
  {
      $dept = array();
      $i=0;
  
      for($i=0;$i&lt;$count;$i++)
      {
          $dept[$i]= $row['name'];
          echo $dept[$i];
      }
  }
  </code></pre>
  
  <p>Ok, i tried to use mysqli but it doesnt work.
  the web server shows that:
  MySQL client version: 4.1.22
  PHP extension: mysql
  Can mysqli works in mysql php extension?</p>