Sorry I'm very new to PHP.I'm trying to use the session variable to update a database. It says I'm logged on but only inserts the data when I have the actual name in the code and not the session variable. It seems like this code should work but it's not updating the database.
<?
if($logged_in){
echo 'Logged in as '.$_SESSION['username'].', <a href="logout.php">logout</a>';
$q = "UPDATE userslogin SET test='help' where username= " . $_SESSION['username'] . " ";
$result = mysql_query($q,$conn);
?>
<?
if($logged_in){
echo 'Logged in as '.$_SESSION['username'].', <a href="logout.php">logout</a>';
$q = "UPDATE userslogin SET test='help' where username= " . $_SESSION['username'] . " ";
$result = mysql_query($q,$conn);
?>