updatet with additional mysql error messages
based on Feedback from Stefan Rickauer