Jump to content

What's wrong with this code snipet?


jumpenjuhosaphat

Recommended Posts

  else  {	$result = mysql_query("SELECT * FROM user");	while($row = mysql_fetch_array($result))	{	  if($row['id']==$_COOKIE["user"])		{		  $username=$row['username'];		}	}	include("body.php");  }

For some reason the variable $username isn't being set when this code returns true. Sorry if it's an obvious answer, I'm a newbie.

Link to comment
Share on other sites

Try this:

else  {	$result = mysql_query("SELECT * FROM user");	while($row = mysql_fetch_array($result))	{	  if($row['id']==$_COOKIE["user"])		{print_r($row);print_r($cookie);		  $username=$row['username'];		}	}	include("body.php");  }

This should print the array values for debugging.*editted*changed the location of the print _r()'s

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...