If the output mysql_real_escape_stringis different from the input, then the input contains unsafe characters. You might conclude that the user may have tried to attack, especially if the field in question is one where you usually expect a small number of insecure characters (such as a zip code).
But this may be because their name turned out to be Robert'); DROP TABLE Students; --.
Thus, in general, there is no way to do this, even close to reliable.
source
share