Just had a catastrophe in my database. Whilst updating a single record the whole dataset was updated. Eventually worked it out to be a '#' symbol in the data. For example the query should read:
UPDATE daily_sales SET grosssales = 1100.00 WHERE salesdate = '2007-04-16'
but due toi a validation failure the query was:
UPDATE daily_sales SET grosssales = 1100.00# WHERE salesdate = '2007-04-16'
Looked through some syntax sites for SQL and can't work out why the query should not have just failed rather than screw up all my records. Couldn't find anything on the mySQL site either. Anyone enlighten me?
Also, as an aside the value at fault is checked using for following php:
If (!ereg('-*([0-9]{1,4}).([0-9]{1,2})',$_POST[$fieldname])) {
$errorsfound = true;
$errorlist[$fieldname].='value should be in form 0.00<BR>';
}
How come it didn't throw an error?
Thanks