So I made this flash game and all appropriate variables are entered. If a user is logged in, it SHOULD enter the variable $_SESSION[user] into the mysql database to store the user's score. For some strange reason, it doesn't do that. What makes it even stranger is that I can echo the $_SESSION[user] variable correctly, but when thrown into a mysql DB, it returns NULL (as 0). Here's the code that does all the processing.
<?php
session_start();
?>
<html>
<?php
include("../package.php"); //stuff for UI
echo $_SESSION[user]; //this works
if($_SESSION[user]){
mysql_query("INSERT INTO `DB`.`TABLE` (`user`,`type`,`game`,`score`) VALUES ('$_SESSION[user]', '$_POST[type]', '$_POST[g]', '$_POST[score]')");
?>
//Congratulations message in HTML
<?php
}
else{
?>
//Tells you to login (the 'else' statement to if($_SESSION[user])) also in HTML
<?php
}
?>
I don't see anything wrong....