I am trying to allow users to Update their details/entry.
My Php code:
include_once('connect/database_connect2.php');
$sql="UPDATE advert_table SET for_sale = '$for_sale', sale_amount = '$sale_amount', seeking = '$seeking', advert_text = '$advert_text', contact_preference = '$contact' WHERE advert_id = '$e'";
if($up_date = mysqli_query($dbc, $sql))
{
print_r($up_date);
var_dump($up_date);
if(mysqli_affected_rows($dbc) >= 1)
{
print'<div style="border:1px solid #0066FF; padding:5px 5px 5px 20px; width:96%; background-color:#F0F0F0; ">';
print'<p>Your add was Updated succesfully <a href="member_zone.php?m=myadds"><img style="padding:5px;vertical-align:middle;"src="./images/ok.png" alt="ok" /></a></p>';
print'</div>';
}
}
else
{
print'<div style="border:1px solid #0066FF; padding:5px 5px 5px 20px; width:96%; background-color:#F0F0F0; ">';
print'<p>Unable to Update Entry <a href="somewhere.php?m=myadds"><img style="padding:5px;vertical-align:middle;"src="./images/ok.png" alt="ok" /></a></p>';
print'</div>';
}
All variables have been duly escaped and sanitized before arriving to the $sql.
I have checked the connection and it is established.
I have checked the variables and they exist, and are the format they are in the database. $update gives a 1 YES Boolean as result.
But database is not updated, and no Notification of the If or Else comes out. I cannot see my error. Can anyone help ?
Thank you.