hm that worked! but i tried using the same style for a 'delete from the banned list' form and it's acting weird.
PHP Code:
if(!empty( $_POST['release'])) {
$release_this = $_POST["rel_ip"];
$take = "DELETE FROM `banned` WHERE `IP`='$release_this'";
$taken = mysql_query($take, $connection);
if (mysql_num_rows($taken)==0)
{
echo "the ip has been released successfully.<br /><br />";
}
else{
echo "that IP is not on the banned list. <br /><br />";
}
}
it removed the ip, but it also displays the echo. even if the ip is not there, it will say it was successfully removed. i don't quite understand the ==0 part of that mysql_num_rows line. i thought that is saying if no rows are returned(meaning the requested ip is NOT in the ban list), it would echo the first statement(i initially had 'ip is not found' there). but it echos that statement when it's successful...and even when the ip isn't on the ban list.
edit: so bizarre, when i change that to ==1 it always echos the else statement.

edit2: alright since that's confusing as hell i just used mysql_affected_rows()
PHP Code:
if(!empty( $_POST['release'])) {
$release_this = $_POST["rel_ip"];
$take = "DELETE FROM `banned` WHERE `IP`='$release_this'";
$taken = mysql_query($take, $connection);
echo "IPs released: ".mysql_affected_rows()."<br />";
}
edit3: so yeah now it does what i want it to, does this look right? the reason i ask is because sometimes i'll write something that works, but it'll be completely unorthodox or outdated.
PHP Code:
if(!empty( $_POST['release'])) {
$release_this = $_POST["rel_ip"];
$take = "DELETE FROM `banned` WHERE `IP`='$release_this'";
$taken = mysql_query($take, $connection);
if(mysql_affected_rows()==1){
echo "the IP has been successfully released.<br />";
}
else{
echo "that IP does not exist in the banned list.<br />";
}
Bookmarks