Hey,
I get this error =
Warning: mysql_result(): Unable to jump to row 1 on MySQL result index 6 in /usr/home/mickyg/domains/mickyg.co.uk/public_html/Alert/togoinhomepage.php on line 54
Warning: mysql_result(): Unable to jump to row 2 on MySQL result index 7 in /usr/home/mickyg/domains/mickyg.co.uk/public_html/Alert/togoinhomepage.php on line 54
Warning: mysql_result(): Unable to jump to row 3 on MySQL result index 8 in /usr/home/mickyg/domains/mickyg.co.uk/public_html/Alert/togoinhomepage.php on line 54
Warning: mysql_result(): Unable to jump to row 4 on MySQL result index 9 in /usr/home/mickyg/domains/mickyg.co.uk/public_html/Alert/togoinhomepage.php on line 54
And this is my code (Message is put into a database and this script below will read out the message and delete it if its for an individual or if its for everyone will add their IP to a list so they dont get it read out again._ Line 54 is in Bold.
<?PHP
session_start();
//MYSQL CONNECTIONS
$username = "user";
$password = "pass";
$database = "test";
mysql_connect(localhost,$username, $password);
@mysql_select_db($database) or die("Database Error");
//INDIVIDUAL MESSAGE
$clientip = getenv(HTTP_X_FORWARDED_FOR);
echo($clientip);
$queryr = "SELECT * FROM `table` WHERE ip = '$clientip'";
$resultr = mysql_query($queryr);
$row = mysql_num_rows($resultr);
echo($row);
if($row > 0) {
//IS MORE THAN ONE OR IS ONE
$i=0;
while ($i < $row) {
$type=mysql_result($resultr,$i,"type");
$msg=mysql_result($resultr,$i,"msg");
if($type == "site") {
echo("<script language=\"Javascript\"> alert(\"$msg\") </script>");
$id=mysql_result($resultr,$i,"id");
mysql_query("DELETE FROM `table` WHERE id=$id");
}
}
}
//FOR ALL
$queryr = "SELECT * FROM `table` WHERE type = 'all'";
$resultr = mysql_query($queryr);
$row = mysql_num_rows($resultr);
echo($row);
if($row > 0) {
//IS MORE THAN ZERO OR IS ZERO
$i=0;
while ($i < $row) {
$msg=mysql_result($resultr,$i,"msg");
$number=mysql_result($resultr,$i,"ip");
$queryr = "SELECT * FROM `table` WHERE ip = '$number'";
$results = mysql_query($queryr);
[B]$finalrest = mysql_result($results,$i,"user");[/B]
if(str_replace($clientip,$clientip,$finalrest))
{
echo("<script language=\"Javascript\"> alert(\"$msg\") </script>");
$finalrest = $finalrest + " " + $clientip;
$querys = "UPDATE `table` SET `user` = '$finalrest' WHERE `ip` = '$number'";
mysql_query($querys);
echo($number);
} else {
echo("SENT ALREADY" + $number + " // ");
}
$i++;
}
}
?>
Thanks,
Micky