For some reason, this script won't add data to my mysql table.

PHP Code:
//Log Information
if($global_tracking == "yes"){
    if(
$LOGGEDIN == "yes"){
        
$who $UNAME;
    } else {
        
$who $_SERVER['REMOTE_ADDR'];
    }
    
$where $_SERVER['PHP_SELF'].'/'.$_SERVER['QUERY_STRING']; //Gets page there on plus anything like "?id=blah"
    
$when date("M j, Y");
    
$when $when." at ";
    
$when $when.date("g:i a");
    
    echo 
"Who =".$who." and Where = ".$where." and When = ".$when;
    
    
mysql_query("INSERT INTO log (who, where, when) VALUES('$who', '$where', '$when' ) ") or die(mysql_error());  


When i put it on a page, it spits out this error:
Code:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'where, when) VALUES('71.75.243.99', '/angel/index.php/', 'Jul 5

Anyone know how to fix this? I searched up the error on google, and people get thir error when creating tables, but for some reason, i get it when INSERTING data........ any help?