The primary key is incremented with every new record, but I do this myself instead of letting MySQL do it for me.
Get the last primary key generated... Get the next new unique primary key by incrementing the last key created... ... //gap between getting the key and inserting it. ... Insert new record with new unique primary key into table...
Apparently, a web server's CPU multitasks when more than one person requests a web page.
The corruption is a result of two instances of the above PHP script running at the same time.
Before the first task inserts the new primary key into the table, the second task come through and generates the same key.
To fix this problem, I closed the gap between getting and inserting the new key, but I think that is more of a band-aid than a cure. The gap still exists but is smaller.
I need to know how to fix this. Any help would be appreciated.