Hello!

I run an educational website which has an assessment component. Students submit multiple choice answers and they're saved in my database (MySQL) to be compared to the correct solutions at a later date. So far I've had 12,000 student responses without a hitch. On the last assessment, however, 1 particular student had 4 responses which were marked as incorrect though, her answers in the database seemed to match the correct solutions. After further investigation, I noticed that each of these submitted solutions had an extra space at the end of the entry. This surprised me since the questions were multiple choice questions, and I'm just posting the solutions which I've echoed out after getting them from my database; further, none of the other students had this issue. The quick fix was to compare the trimmed solutions using PHP's trim(), getting rid of any extra database spaces. However, it's a bit disconcerting for my code to work for everyone, all of the time, except for this one student.

My question then, is whether extra end spaces may be accidentally inserted into databases due to connection issues, or if there's some other possibility for this odd behavior.

I appreciate that this is a bit of a question without specifics and may be difficult (impossible?) to answer. However, any insights/thoughts would be appreciated.

-Eric