ryeman98 Posted June 2, 2007 Share Posted June 2, 2007 I have everything working except for the update. Here is the info. Edit form: <?php } elseif ($_GET['action'] == "edit") { $id = $_POST['id']; $edit = mysql_query("SELECT * FROM news WHERE id='$id'"); $display = mysql_fetch_array($edit); echo " <table border=0 cellpadding=0 cellspacing=2> <form name=\"editarticle\" action=\"/article.php?action=update\" method=\"post\"> <tr valign=top><td><strong>Title:</strong></td> <td><input type=\"text\" name=\"title\" size=\"60\" value=".$display['title']." /></td></tr> <tr valign=top><td><strong>Date:</strong></td> <td><input type=\"text\" name=\"date\" value=".$display['date']."</td></tr> <tr valign=top><td><strong>Content:</strong></td> <td><textarea name=\"content\" maxlength=\"10000\" cols=\"50\" rows=\"10\">".$display['content']."</textarea></td></tr> <tr valign=top><td><strong>Password:</strong></td> <td><input type=\"password\" name=\"password\" /></td></tr> <tr align=right><td></td><td><input type=\"submit\" name=\"submit\" value=\"Edit Article\" /></td></tr> </form></table>"; } Update code: <?php elseif ($_GET['action'] == "update") { $title = $_POST['title']; $date = $_POST['date']; $content = $_POST['content']; if ($_POST['password'] == "oilersrock") { $update1 = ("UPDATE SET title='$title'") or die(mysql_error()); $update2 = ("UPDATE SET date='$date'") or die(mysql_error()); $update3 = ("UPDATE SET content='$content'") or die(mysql_error()); echo "Your article has been updated."; } } ?> I've tried a few things. Maybe I'm just tired but anyways, thanks in advance! Rye Link to comment https://forums.phpfreaks.com/topic/53956-update-help/ Share on other sites More sharing options...
Orio Posted June 2, 2007 Share Posted June 2, 2007 I can see two problems: First, you haven't use mysql_query(), just a pair of brackets. Second, the syntax of your update queries is wrong, you didn't specify the table's name. It should be: UPDATE table_name SET ... WHERE ... Orio. Link to comment https://forums.phpfreaks.com/topic/53956-update-help/#findComment-266759 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.