1. the cannot resolved variable is emp_id ? if yes define as you defined num .
2. why do you depends on row count for your employee id. you will endup with same employee id for different employees.
for example: employee_id is 10 now . then somebody remove some employee(say 5th employee) now rowcount become 9.
=> when you enter new employee he will get 10 again!