title: Select from database and store in an array
body: <p>I want to select some data from db and store in an array. Suppose I have a column "keyword" in my db table. I want to select all rows where keyword column is like "nature". </p>
  
  <p>I am trying following code:</p>
  
  <pre><code>&lt;?
      $term= "nature";    
      $arr = array();
  
      $sql = "select keyword from keywords where keyword LIKE '%$term%'";
      $result = mysql_query($sql) or die(mysql_error());  
      $rows = mysql_fetch_array($result); 
      foreach ($rows as $row){
              array_push($arr, $row['keyword']);
          }
  
      print_r($arr); //output: Array ( [0] =&gt; n [1] =&gt; n ) 
  
      ?&gt;
  </code></pre>
  
  <p>So the result from db should return only one keyword 'nature' which i need to store in array.</p>
  
  <ol>
  <li>Why it is storing same string two times? There is no any other row in db similar to the term nature.</li>
  <li>Why it is storing only first letter in the array? Shouln't it store "nature" instead of "n"?</li>
  </ol>
  
  <p>Please help me fixing this.</p>