2
I have a problem with my system that is the following,
try {
$sql = "SELECT Nid+1 AS Nid FROM noticias ORDER BY Nid DESC LIMIT 1";
$stmt = $DB->prepare($sql);
$stmt->bindValue(":Nid", intval($_GET["Nid"]));
$stmt->execute();
$results = $stmt->fetchAll();
$Npasta = $results[0]["Nid"];
} catch (Exception $ex) {
echo $ex->getMessage();
}
I am taking the last registered ID and creating a folder with the same number but when I delete the last id the count becomes wrong because EX: I entered the id 998, after inserting deleted, the next that I will insert it will get 998 again , where the right was to get the id 999; Some light on that?
Instead of this column, in a college paper, I was instructed to do an extra audit table, where I would save anything that was excluded. This suggestion is also good?
– user28595
@Diegofelipe, the extra table of your work seems to me to be in another context, in the log operations. In the reply suggest it to avoid a delete, so to bring all news 'not deleted' would be something like this,
select * from noticias where excluida = false
– rray