php - enable button only if older than 90 days -
good day
i have delete button deletes entries on database, problem want disable button , enable if older 90 days.
i used code , it's working if it's not older 90 days still replies "successfully deleted" although not deleted , why thought easier disable delete button , enable if entry older 90 days
please assist
thanking you
$sql="delete client_post id = '$id' , date < date_sub(now(), interval 90 day)"; $result=mysql_query($sql); if($result){ echo('entry '.$id.' deleted <br>'); } else{ echo('<br>failed delete'); };
change if statement to:
if($result && mysql_affected_rows() > 0){
problem code checking if $result true, while $result identifier of mysql_query() results. should check how rows affected query.
Comments
Post a Comment