Jump to content

[SOLVED] [HELP] function GetPlayerStats($sqlid,$output)


R4nk3d

Recommended Posts

So im making this command right now and this is what it looks like:

function GetPlayerStats($sqlid,$output)
{
if(!isset($output)) define("outputa","\$r");
else if(isset($output)) define("outputa","\\".$output);
$result = mysql_query("SELECT * FROM ".sql_users." WHERE id='".$sqlid."'");
if(!$result) return 0;
if(mysql_num_rows($result) == 1)
{
	$output = mysql_fetch_array($result);
	return $output;
}
else return 0;
}

So what im [attempting] to do is grab the info from a playerid in my database, get the info from it, and then output it into an array and return it. This is the format im using it in:

GetPlayerStats($_SESSION["ID"],"$r");
			echo($r['username']);

So it echoes it right out. I want to be able to change the output so other people can change it to what they like, $row, $sql, etc. But it won't work. If you know how i can fix it please enlighten me :)

 

p.s. anyone remember how to make a variable not needed in a code so i dont get the "Missing argument 2 for GetPlayerStats()" error when i dont put "$r" in the command?

 

 

Thanks in advance

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.