title: Array to string conversion in......array
body: <p>I want to get the average of a column in a table,</p>
  
  <p>table: buy
  column: c1</p>
  
  <p>when I called the database
  with this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>$query="Select AVG(c1) as average FROM buy";
  $result_array=mysql_query($query);
  $line = mysql_fetch_array($result_array);</code></pre>
  </div>
  </div>
  </p>
  
  <p>and when I called with <code>php</code> like this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php echo $line; ?&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>it came up error with this message</p>
  
  <p><strong>Array to string conversion in .......... on line 50
  Array</strong></p>
  
  <p>what did I do wrong? I think because I treated arrays as a string. but how can i fix this?</p>