title: PHP: Warning: sort() expects parameter 1 to be array, resource given
body: <p>I wanted to arrange the array of table list with sort() function but i am getting same kind of warning.</p>
  <pre><code>&lt;?php 
  require_once(&quot;lib/connection.php&quot;); 
  
  $result = mysql_query(&quot;SHOW TABLES FROM `st_db_1`&quot;);
   
  sort($result);
  foreach ($result as $result){
      echo $result ;
  } 
  ?&gt;
  </code></pre>
  <p>and the warning I am getting are:</p>
  <blockquote>
  <p>Warning: sort() expects parameter 1 to be array, resource given in C:\wamp\www\Copy (4)       of st_db_1\test_2.php on line 9
  Warning: Invalid argument supplied for foreach() in C:\wamp\www\Copy (4) of st_db_1\test_2.php on line 10</p>
  </blockquote>