Function does not return correct resource
<p>Guys, hi. I have this fuctions:</p>

<pre>
function query_dp($sql){

    $link = mysql_connect('localhost', $bd_id, $bd_pass);
    mysql_select_db("$bd");

    if (!$link) {
        die('Could not connect: ' . mysql_error());
    }


    return mysql_query($sql) or die(mysql_error());

    mysql_close($link);

}
?>
</pre>

<p>In the main program, when i try to do:</p>

<pre>
echo mysql_num_rows(query_db($sql));
</pre>

<p>I get as return</p>

<pre>
1
</pre>

<p>When I do not encapsulate that code in a function and use it directly to the main program, i get the number of rows fetched.</p>

<p>The function is not returning a Resource but a... integer? WTF?</p>

<p>Any help would be greatly appreciated!</p>

<p>Thanks!!</p>
