Here's the snippet of code.
case "list":
$selectnews = "SELECT * FROM news";
$querynews = mysql_query($selectnews) or die(mysql_error());
while($news = mysql_fetch_array($querynews)){
extract($news);
echo "<a href='shadowpanel.php?act=news&code00=edit&id=$id'>$title</a><br>";
}//whileend
break;
case "edit":
$selectna = "SELECT * FROM news WHERE id = '$id'";
$queryna = mysql_query($selectna) or die(mysql_error());
$title2 = mysql_result($queryna, 0, title);
$author = mysql_result($queryna, 0, author);
$content = mysql_result($queryna, 0, content);
$email = mysql_result($queryna, 0, email);
echo "<form action='shadowpanel.php?act=news&code00=editpost&id=$id' method='POST'>
Title: <input type='text' name='title' value='$title2'><br>
Author: <input type='text' name='author' value='$author'><br>
Email: <input type='text' name='email' value='$email'><br>
<textarea width='500' height='500' name='content'>$content</textarea><br>
<input type='submit' value='Edit'>
</form>";
break;
case "editpost":
$title2 = $_POST[title];
$author = $_POST[author];
$email = $_POST[email];
$content = $_POST[content];
$insertedit = "UPDATE news SET title = \"$title2\" AND author = '$author' AND content = \"$content\" AND email = '$email' WHERE id = '$id'";
$queryedit = mysql_query($insertedit) or die(mysql_error());
if($queryedit){
echo "Update complete!";
}
else {
echo "There was a problem.";
}
break;
This is the part of the code that applies to the part of this. Does anyone see a problem with it? If so, how can I fix it?
Remember, this is only a part of the whole code for my administration that I'm trying to code.
EDIT: Hahaha, I got it. You don't use AND in the UPDATE query, you use commas.
