Read your compiler error message!
Basically it's complaining you have an undefined variable on line 62, which is this line:
$res = mysql_query(sql) or die(mysql_error());
There's something wrong with that line, namely you're missing the $ in front of sql. It should be $sql, not sql.