Thanks for helping me a lot. I have a simple doubt.
I made a form that deletes records from a table, it works correctly, but I can not get an error message saying that the record does not exist, it simply says that I delete it (When that record is not present, it says that I delete it, when it's not true).
This is what I have done so far.
The html:
<div id="borrador"> <!-- La forma de borrar datos -->
<form method="POST" action="disenoclaseborrar.php" style="padding:50px 250px;">
<h1>Escriba el nombre del profesor para borrar su clase</h1>
<input type="text" placeholder="Escriba el nombre del profesor para borrar la clase" name="nombreprofe" id ="nombreprofe" required></input>
<div id="input submit" style="text-align: center;;"><input type="submit" id="submit" name="submit" class="floated" value="Borrar clase"></input></div>
</form>
The php:
<?php
$nombreprofe = $_POST['nombreprofe'];
$db = mysqli_connect('localhost', 'root', '', 'prueba');
$nombreprofe = mysqli_real_escape_string($db, $nombreprofe);
$query = "DELETE FROM reservadiseno WHERE nombre = '$nombreprofe'";
$result = mysqli_query($db, $query);
$res = '';
if ($result > 0) {
$res = 'Se borraron los datos. Refresque la pagina para ver la tabla denuevo';
echo $res;
}else{
$res = "No se encontro nada para borrarlo";
echo $res;
}
?>