hi I'm new to the world of PHP scripting and I have pb with this script: the goal is to fetch article an article from a database, insert it into a text area and update it with a new text. The only thing I manage to do is update ALL article in the table, and not the one linked to the specific ID of the article... please help.
This is the script of the second page once the article has been fetched... (passing the string $update)
thanks in advacne for your help
paul
$result = @("SELECT Feature FROM Article WHERE ID = '$update'");
if (!$result) {
echo ("error" . mysql_error());
}
while ($row = mysql_fetch_array($result)){
$Feature = $row["Feature"];
echo ("<form action=$PHP_SELF? method=post>");
echo ("<textarea name=new_text rows=10 cols=40 wrap>$Feature</textarea><br/>");
echo ("<input type=submit name=editarticle value=edit><br/></form>");
}
if ($editarticle == "edit") {
$result = "UPDATE Article SET
Feature='$new_text',
FeatureDate=CURDATE()
WHERE ID='$update'";
if (@mysql_query($result)) {
echo("<p>Your Article has been updated.</p>");
} else {
echo("<p>Error adding submitted Article: " .
mysql_error() . "</p>");
}
}
echo("<p><a href='update.php'>back</a></p>");
?>
</body>
</HTML>