Mysql
 sql >> Database >  >> RDS >> Mysql

Come posso aggiungere un messaggio che dice $ user_id Eliminato o $ user_id non trovato?

<?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";
}

?>