the code works? the above warnings suggest that ter is a mysql syntax error. moreover the documentation of mysql_affected_rows suggests that u should supply a valid recource identifier but not a mysql result resource. i.e., the above should be mysql_affected_rows($db)