In my database, I have a table of IPs that I have banned from accessing certain things in my PHP script. When I enter my IP into the database (as a string, example "123.4.5.6") and it doesn't seem to echo "banned", when I have clearly entered my IP into the banned database table.
<?php
require_once('config.php');
$ip = $_SERVER['REMOTE_ADDR'];
$checkipban "SELECT * FROM banned WHERE bannedip = '$ip'
";
$banquery = mysql_query($checkipban,$con);
if(mysql_num_rows($banquery) > 0)
echo "banned";
}
?>
$con is the connection to the database in config.php and it works because other MySQL queries in the script work. The database table is called banned and there is only one column called bannedip.