R4nk3d Posted April 11, 2009 Share Posted April 11, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/153599-solved-help-function-getplayerstatssqlidoutput/ Share on other sites More sharing options...
wildteen88 Posted April 11, 2009 Share Posted April 11, 2009 It'll be ablot easier if you did $myvar = GetPlayerStats($_SESSION["ID"]); What you're trying to do is over complicating things abit. Quote Link to comment https://forums.phpfreaks.com/topic/153599-solved-help-function-getplayerstatssqlidoutput/#findComment-807168 Share on other sites More sharing options...
R4nk3d Posted April 11, 2009 Author Share Posted April 11, 2009 ok, and if i do that itll still return the array? Quote Link to comment https://forums.phpfreaks.com/topic/153599-solved-help-function-getplayerstatssqlidoutput/#findComment-807383 Share on other sites More sharing options...
R4nk3d Posted April 11, 2009 Author Share Posted April 11, 2009 ok, well since i cant edit my last post, ill just say, yay. i got it working thank you Quote Link to comment https://forums.phpfreaks.com/topic/153599-solved-help-function-getplayerstatssqlidoutput/#findComment-807426 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.