I'm using a function that calls generic information that many other functions need to run but my other functions can't seem to get any information from the global vars
$username = $_SESSION['username'];
function getcharacter($ctoget, $ctype)
{
$select_character = mysql_query("SELECT * FROM characters WHERE member = '".$ctoget."' AND type = '".$ctype."'");
$fetch_character = mysql_fetch_array($select_character);
//get character
global $cname, $wpn1, $wpn2, $cmaxhp, $ccurrenthp, $carmor, $cmaxhp, $cattack;
$cname = $fetch_character['name'];
$wpn1 = $fetch_character['wpn1'];
$wpn2 = $fetch_character['wpn2'];
$cmaxhp = $fetch_character['maxhp'];
$ccurrenthp = $fetch_character['currenthp'];
$carmor = $fetch_character['armor'];
$cattack = $fetch_character['attack'];
}
I'm having problems with this function
function thisonedoesntwork($attacker)
{
getcharacter($username, character);
$tmpwpn1 = $GLOBALS['wpn1'];
$tmpcarmor = $GLOBALS['carmor'];
echo "$tmpwpn1 and $tmpcarmor";
}
These variables that are echoed at the end have no value. What am I doing wrong?