iStriide Posted August 20, 2011 Share Posted August 20, 2011 I'm not sure what is going on in this code, but for some reason it is not echoing my variable. I'm probably just having a total brain fart right now. <?php <?php $opponent_check = isset($_POST['player_username']); $session = isset($_SESSION['user']); if($opponent_check){ include_once('connect.php'); $find_player = "SELECT * FROM stats WHERE Username = '$session'"; $s = mysql_fetch_array(mysql_query($find_player)) or trigger_error(mysql_error()); $player = $s['Username']; $player_HBS = $s['HBS']; $player_level = $s['Level']; $player_level_image = $s['Level_Image']; $player_skill = $s['Skill']; $player_attack = $s['Attack']; $player_defense = $s['Defense']; $player_strength = $s['Strength']; $player_speed = $s['Speed']; $player_accuracy = $s['Accuracy']; $player_range = $s['Range']; echo $player; }else{ echo " You didn't start a battle.<br/><br/> <a href='index.php'>Back to Matchmaking</a> <br/><br/> "; } ?> ?> My error is: Notice: in C:\xampp\htdocs\halobattles\headtohead.php on line 277 which is the fetch array line. Quote Link to comment https://forums.phpfreaks.com/topic/245251-having-variable-problem-i-think/ Share on other sites More sharing options...
iStriide Posted August 20, 2011 Author Share Posted August 20, 2011 I tried without the isset with the $session variable and it worked. Quote Link to comment https://forums.phpfreaks.com/topic/245251-having-variable-problem-i-think/#findComment-1259636 Share on other sites More sharing options...
MasterACE14 Posted August 20, 2011 Share Posted August 20, 2011 this: $opponent_check = isset($_POST['player_username']); $session = isset($_SESSION['user']); should be this: if(isset($_POST['player_username'])) $opponent_check = $_POST['player_username']; if(isset($_SESSION['user'])) $session = $_SESSION['user']; Also this: if($opponent_check){ should be this: if(isset($opponent_check)){ Quote Link to comment https://forums.phpfreaks.com/topic/245251-having-variable-problem-i-think/#findComment-1259655 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.