From outside get Var value inside class

Hi all,
Iā€™m practicing (hands on :slight_smile: class in PHP and I have problem with this code:


Class DBSQL
{  
	function showadmin($sql="")
	   {
	   $conn = $this->CONN;
	   $result = mysql_query($sql,$conn); 
	   return $result;
	   }
}

$db = new DBSQL($DBName);
$showadminuser = "select adminid, username from
newsadmin";
$db->showadmin($showadminuser);

How can I do to get $result to continuous writing these line:


while ($row = mysql_fetch_array($result)){
	$adminid=$row['adminid']; 
	$username=$row['username']; 	print "$username 
";
	}

Please show me, thanks men.