Unable to fetch exact number of elements in php array from sql database
<p>I have a database table called user which only have one entry in it. After making connection I do this</p>

<pre><code>function dbQuery($sql)
    {
    $result = mysql_query($sql) or die(mysql_error());

    return $result;
    }
</code></pre>

<p>this runs the query received. Then</p>

<pre><code>function getUser(){
    $sql = "select username from user";
    return dbQuery($sql);
}
</code></pre>

<p>Now I call this <code>getUser()</code> function to fetch the username</p>

<pre><code>while($row=mysql_fetch_array(getUser())){
    echo($row['username']);
  }
</code></pre>

<p><strong>the problem is that it prints the username infinitely. Please Help</strong></p>
