foreach($article AS $key => $value)
{
mysql_query("UPDATE articles SET description = '".mysql_real_escape_string($value)."' WHERE id = '".$key."'");
}
Hi guys,
I have this very simple foreach loop where I run an UPDATE query. Yeah, I know that I should use PDO but I'm just testing it so don't worry. $key and $value are not null. I've already verified that their values are the expected ones. $value contains a string with multiple \n (new line).
Now the script is working on my server but as soon as I try it on another server the UPDATE statement doesn't get triggered. No errors or warning. It seems that the other server doesn't like the content of $value. In fact if I replace $value for example with "abc" it works. So I'm here trying to understand what the problem. The \n? The mysql_real_escape_string? What should I do to debug this issue?
Try this