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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.