Does the browser "wait" and spin and spin while you're doing this? Did you check it later (like, at least 5 minutes) and find all the records indeed populated?
I'm guessing the server just times out. When you make a request to a dynamic script, the script **must** return a response (even if it's an empty response) or it will push a 500 to the browser. Those of us who worked in perl know the importance of this, you can't "call" a script without outputting a response.
If it's indeed working and just timing out, you can look into how you can optimize it to run faster, if you can't, I'd look into fork (pcntl_fork() in PHP.) You can use fork to spawn the time consuming process as a child, and you can check on that child's process ID from the parent to know if it completed or not. When the child PID dies, it's done.
yes, though i get this 500 internal error message. once i logout from sreen and re-login again in th UI. All 200 record are gets added successfully. it just gives above error when we try to assign 200 records. but once we reload that page these records were successfully gets added. Also same scenario happend during deletion also when i try to delete all assigned 200 records it gaves same error. but once we relogin into application UI. these records gets deleted.