Im having an issue with the MySQL in a program my friend sent me:
The Code:
<?
//if($_SERVER['REMOTE_ADDR'] != "98.226.56.186") {
//exit("<table width=100% height=100%><tr><td align=center><table cellpadding=0 cellspacing=0 style=\"border: solid 1px #000000\" width=200><tr><td bgcolor=#cccccc><font face=verdana><b>Updating</b></font></td></tr><tr><td><font face=verdana>10 min, changing ranks</font></td></tr></td></tr></table>");
//}
session_start();
##############################################################################################
$connection = mysql_connect("host", "username", "password");
mysql_select_db("database", $connection);
##############################################################################################
$newresult = mysql_query("SELECT * FROM `ipban` WHERE `ip` = '".$_SERVER['REMOTE_ADDR']."'");
if(mysql_num_rows($newresult) == 1) {
unset($_SESSION['id']);
header("Location: http://www.google.com");
exit;
}
Thats the bit of code where the error comes from, specificly it comes from Line 11:
if(mysql_num_rows($newresult) == 1) {
When this is on my server I get this error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in ...