I am trying to figure out how to update the data in a specific database row instead of deleting and then inserting another query again. Does anyone know how I could go about doing this?
main.php contents
<body>
<h1>Introduction Box</h1>
<form action="edit.php" method="post">
Title: <input type="text" name="introtitle">
Description: <textarea name="introdescription"></textarea>
<input type="submit">
</form>
</body>
edit.php contents (Right now this only adds the entry from the form)
<?php
// Connnection to MySQL
$connection = mysqli_connect("");
// Check Connection and Display If Error
if (mysqli_connect_errno($connection)) {
echo "Failed to connect to MySQL: " . mysqli_conncet_error();
}
$introduction="INSERT INTO Introduction (Title, Description)
VALUES ('$_POST[introtitle]','$_POST[introdescription]')";
if (!mysqli_query($connection, $introduction) or die(mysql_error()))
{
die('Error: ' . mysqli_error($connection));
}
echo "Record has been updated.";
mysqli_close($connection);
?>
Any help will be greatly appreciated!