Im getting really frustrated about the UPDATE query...
Ive searched 9 pages of google
What I am trying to create is a "edit news page".
When I click on submit, it say the data is inserted but in fact it isnt.
I have 2 files.
Edit.php
<?php include "../config.php"; ?>
<?php
//variabelen
mysql_query("SELECT * FROM news WHERE id = '".$_GET['id']."'") or die(mysql_error());
$id = $_POST["id"];
//Toevoegen
if (isset($_POST['submit'])){
mysql_query("UPDATE news SET title = '".$_POST['title']."', post = '".$_POST['post']."'
WHERE id = '$id'") or die(mysql_error());
//Klaar
echo "Data Inserted!";
}
?>
Click <a href="../index.php">here to return.</a> editnewsview.inc.php
<?php include "../../config.php"; ?>
<?php
// Get all the data from the "news" table
$result = mysql_query("SELECT * FROM news WHERE id = '".$_GET['id']."'") or die(mysql_error());
echo "<table border='0' width='400'>";
while($row = mysql_fetch_array( $result )) {
?>
<form method="POST" action="edit.php">
<input type="hidden" name="id" value="<?php $row['id']; ?>">
<tr>
<td>
<span class="kop">News Title:</span>
</td>
</tr>
<tr>
<td>
<span class="content"><input type="text" name="title" class="textfield" value=" <?php echo $row['title'];
?>" /></span><br /><br />
</td>
</tr>
<tr>
<td>
<span class="kop">News Post:</span>
</td>
</tr>
<tr>
<td>
<span class="content"><textarea type="text" name="post" class="textarea" cols="40" rows="20" />
<?php echo $row['post']; ?></textarea></span>
<br /><br />
</td>
</tr>
<tr><td><input type="submit" class="submit" name="submit" value="Edit News" /></td></tr>
<?php
}
echo "</table>";
?>I really dont know whats wrong, hopefully you could help me
Regards,
