Jump to content
MakeWebGames

Help with Session


Pheonix
 Share

Recommended Posts

I do not know if this belongs here. I am trying something different and need to see what I am doing wrong with this code:

include "dbconnect.php";

$user=$_SESSION['user'];

$userstats="SELECT * from userdb where username='$user'";

$userstats2=mysql_query($userstats) or die("Could not get user stats");

$userstats3=mysql_fetch_array($userstats2);

$username = $userstats['username'];

echo "$username, welcome to my game.";

 

Would this work? Please be kind, I am new to this.

Link to comment
Share on other sites

Re: Help with Session

Thanks for your interest, Floydian. It turns out I was way over complicating things. Here is what I ended up doing that worked:

 

include "dbconnect.php";

$user = $_SESSION['user'];

$other = mysql_query("SELECT * from userdb where username='$user'") or die("Could not get other!");

$try = mysql_fetch_array( $other );

$name = $try['username'];

echo "Welcome $name, to my game";

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

 Share

×
×
  • Create New...