I have a problem with my system that looks like this,
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'm getting 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 inserted the id 998, after inserting it I deleted it, 998 again, where it was certain to get the 999 id; Any light on that?