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

PHP Code:
//Log Information
if($global_tracking == "yes"){
$LOGGEDIN == "yes"){
$who $UNAME;
    } else {
$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 $"g:i a");
"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:
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('', '/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?