I’ve been playing with this :
foreach($textnode as $key => $value) {
$value = stripslashes($value);
$value = mysql_real_escape_string($value, $con);
mysql_query("INSERT INTO paragraphs (paragraphs, url)
VALUES ('$value', '$url')");
}
I’ve been trying to update the column “paragraphs” for where the url already exists
This doesn’t seem to work well as it just replaces each row in paragraphs with the 1st paragraph. (repeats it over and over again)
mysql_query("UPDATE paragraphs SET paragraphs = '$value'
WHERE url = '$url'");
Is the
urlfield unique?If not, add a UNIQUE constraint on it and use
INSERT INTO . . . ON DUPLICATE KEY UPDATEwith something like this:or (do you want to “append” the new
'$value'whenurlalready exists?):