First of, remember to increment your $i ($i++) As far as i know, you can't get the variables defined in a function. You need to either define the variables before your function, or "return" the values. [code] class Foo { function PlayerStats($mid) { $get_stats = 'SELECT * FROM users WHERE mid="$mid" limit 1'; $usr_stats = mysql_query($get_stats) or die(mysql_error()); $i=0; while($stats = mysql_fetch_assoc($usr_stats)){ $player_name[$i] = $stats['username']; $player_email[$i] = $stats['email']; $player_race[$i] = $stats['race']; $player_turns[$i] = $stats['turns']; $player_covert_turns[$i] = $stats['covert_turns']; $player_tylium[$i] = $status['tylium']; $player_production[$i] = $stats['alert_status']; $player_commander[$i] = $status['commander']; $player_status[$i] = $status['status']; $i++; } return array("name" => array($player_name), "email" => array($player_email), "race" => array($player_race), "turns" => array($player_turns), "covertturns" => array($player_covert_turns), "tylium" => array($player_tylium), "production" => array($player_production), "commander" => array($player_commander), "status" => array($player_status)); } }[/code] with this you could call the values with: [code] $foo = new Foo(); $plrsts = $foo->PlayerStats($mid); echo $plrsts['name'][0]; [/code] The above code is quite messy, and could most likely easely get cleaned up - but i noticed you limited your search to only return 1 result, therefor the while, and the extra arrays shouldn't be nessesary: [code] class Foo { function PlayerStats($mid) { $get_stats = 'SELECT * FROM users WHERE mid="$mid" limit 1'; $usr_stats = mysql_query($get_stats) or die(mysql_error()); $stats = mysql_fetch_assoc($usr_stats)); return $stats; } }[/code] call this with [code] $foo = new Foo(); $plrsts = $foo->PlayerStats($mid); echo $plrsts['username']; echo $plrsts['email']; [/code] I havn't tested this so i can't guarenteee it will work first try...