More than 100 people could sometimes access the following script at the same time. This demand greatly slows down the database and the site. Most times what is inserted into the database is not inserted for some unknown reasons. Probably bad scripting.
I want the attached script to be re-written more efficiently.