I have the following php code for updating database records. All the data displays as it should, but when i hit the update button the records do not update. This has been driving me up the wall for a few days now, maybe a fresh pair of eyes will help see where I have gone wrong...
<?php
session_start();
require 'config.php';
if ($_SESSION['login'] == true) {
}
else
{
header("location: user_check.php");
}
$query = "SELECT * FROM Aouncement WHERE useame = '".$_SESSION['useame']."'";
$result = mysqli_query($config,$query)
?>
<table id=table1>
<tr>
<th></th>
<th align="left">Subject</th>
<th align="left">Details</th>
</tr>
<?php
while($row = mysqli_fetch_array($result))
{
echo "<td><form action=alter.php method=post;>";
echo "<td><input type=text name=subject value ="" . $row['subject'] . "" > </td>" ;
echo "<td><textarea rows=10 cols=50>" .$row['details']. "</textarea></td>";
echo "<td><input type=submit name=update value=Update></td>";
echo "</form></tr>";
}
echo "</table>";
if(isset($_POST['update'])){
$update_query = "UPDATE Aouncement SET subject='$_POST[subject]', details='$_POST[details]' WHERE useame = '".$_SESSION['useame']."'";
$update_result = mysqli_query($config,$update_query);
};
$config->close();
?>
