Mysql
 sql >> Base de données >  >> RDS >> Mysql

Comment puis-je ajouter un message indiquant $user_id supprimé ou $user_id introuvable ?

<?php

$con = mysql_connect("localhost", "root", "");

if (!$con) {
    die('could not connect:'  .mysql_error());
}

mysql_select_db("final?orgdocs", $con);

$user_id = (int)$_POST["user_id"];

$result = mysql_query("delete from account where user_id=$user_id");

$affected_rows = mysql_affected_rows();

if ($affected_rows) {
    echo "User ID '$user_id' deleted";
} else {
    echo "User ID '$user_id' not found";
}

?>