hello my code is like below

$result = mysql_query("select home_id,away_id from results");

echo $games; // first echo

echo $games2; //second echo

and my function is

function games_played($team_id,$result2){


while($row = mysql_fetch_array($result2)){


return $counter;

the thing is first echo statement writes 3 , on the screen , but the second one returns 0 .I know its because once i fetch $result in my function , pointer stays at the end of $results . How can i rewind my pointer ? and get 3 as a result of both echos?

thanks for your help and time.