I have the following block of code which checks if information was updated correctly in MYSQL.
After running the script the information is updated correctly in the database however.
“if ($result && mysqli_affected_rows($link) > 0)”
returns false I do not understand why.
Here is my code:
if (isset($_POST[‘submit_update_post’])){
// This part of code is for inputting the information back into the database
if(isset($_POST['edit_info_posted'])){
$info_posted = $_POST['edit_info_posted'];
$link = db_connect();
$sql = "UPDATE posts SET text = $info_posted WHERE post_id = $edited_post_id ;";
$result = mysqli_query($link, $sql);
if ($result && mysqli_affected_rows($link) > 0){
$message = "You successfully updated the information in the database";
}
else {
$message ="David is king";
}
}
Thank you for your help