I have a php page that I use to import orders from a csv file into a mysql database. One varchar in the table is used for the txnid. I discovered that occasionally I'll come across a txnid that results in an "Illegal double value found during parsing" error. For example:
6L831105EP011602
is a fine value that doesn't cause any trouble.
71V72876YH791094
Again, no problems.
546635980E5898057
But this one causes the error, presumably because it is being parsed as a double.
I have tried using mysql_real_escape_string to sanitize the data, but this results in all values being prefixed with ''
unless they would've been parsed as a double.
What is the correct way I should be sanitizing this data? How can I determine if a value is going to cause a parse error before I try to insert it into MySQL?