First of all ... you shouldn't let someone enter something wrong in the database at all.
If an error is found, you should tell the user why it's wrong and let them try again. Shouldn't try to fix it yourself.
Having said that,
If ...
1) I am assuming the number you are talking about is an INT field in the mysql table.
2) $number contains the value the user posted
then ...
$number = str_replace(' ', '', $number);
$number = str_replace(',', '', $number);
$number = str_replace('.', '', $number);
... will do the trick.
There are other, more slick methods, using regex's, but this is easier to understand.