Jump to content

Having variable problem. I think.


iStriide

Recommended Posts

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.

Link to comment
Share on other sites

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)){

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.