Per caso ci metti degli apici nel tuo testo? Possa essere che 5.2 aveva i magic_quotes attivi? Dovresti usare mysql_real_escape_string()