TBsource error mysql_num_rows()

I have an error with the registration form, when someone registers or connects it gives me :

Warning: mysql_num_rows() expects parameter 1 to be resource, null given in \public_html\include\global.php on line 37 Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in \public_html\include\global.php on line 38 Warning: Cannot modify header information - headers already sent by (output started at \public_html\include\global.php:37) in \public_html\takesignup.php on line 137

thanks in advance if you can help me

global.php :

 function get_user_timezone($id) {
            $sql = "SELECT * FROM users WHERE id=$id LIMIT 1";
            $query = mysql_query($sql);
            if (mysql_num_rows($query) != "0") {
     $kasutaja = mysql_fetch_array($query);
     $timezone = $kasutaja["tzoffset"];
     return "$timezone"; } else {
             return "5"; } //Default timezone
 }

takesigneup.php :

mail($email, "$SITENAME user registration confirmation", $body, "From: $SITEEMAIL", "-f$SITEEMAIL");

header("Refresh: 0; url=ok.php?type=signup&email=" . urlencode($email));