The Keeper
03-24-2002, 08:22 AM
if(!mysql_query("INSERT INTO $tablename (name,comment,date,ip) VALUES ('$name','$comment','$date','$ip')")) {
$url = 'blog.php?is=save';
header("Location: $url");
} else {
$maxi = mysql_query("SELECT max(id) FROM blog");
mysql_query("DELETE * FROM blog WHERE id < '$maxi' - 20 ");
header("Location: blog.php");
}
ok I think I borked this.
What it's meant to do is find out what the maximum ID is... then delete all tuples that are 20 or more smaller than that number... so only about the 20 newest tuples are kept at each update.
What have I done wrong, because it's not doing it's function..
$url = 'blog.php?is=save';
header("Location: $url");
} else {
$maxi = mysql_query("SELECT max(id) FROM blog");
mysql_query("DELETE * FROM blog WHERE id < '$maxi' - 20 ");
header("Location: blog.php");
}
ok I think I borked this.
What it's meant to do is find out what the maximum ID is... then delete all tuples that are 20 or more smaller than that number... so only about the 20 newest tuples are kept at each update.
What have I done wrong, because it's not doing it's function..