|
-- Posted by PiXiE at 8:53 am on June 7, 2006
Here is the problem. I have a news page. The news entries come from a database. I have no problem inserting new news entries. I'm trying to write code that will edit existing entries. Here is the code (minus the database connection/header stuff): | Code: | $myUpdate = "UPDATE news SET news_title = '$news_title', news_posted_by='$news_posted_by', news_content= '$news_content' WHERE news_id = '".$news_id."'"; $result = mysql_query($myUpdate); if (!$result) { echo "There was a problem. Please try again."; } else { echo "You have updated successfully."; } } else { ?> | When you first hit the edit button, the current values in the database show up fine in this form. Once I edit the entries and hit submit, "You have updated successfully" is displayed. The weird part is that the database doesn't get updated, but it erases whatever was there before!! What is going on?
|