因此,我有这段代码将添加到 lvl_log 表并在单击此页面时更改生物表中的百分比,当我单击该页面时,不会将任何数据添加到表中。
//Add percentage if it hasn't been clicked yet
$ip = $_SERVER['REMOTE_ADDR'];
$cq = "SELECT ip FROM lvl_log WHERE ID = '$id' AND IP = '$ip'";
$cresults = mysql_query($cq);
if(mysql_num_rows($cresults) == 0)
{
if($percent != 100)
{
$newpercent = $percent + 5;
mysql_query("UPDATE Creatures SET Percent='$newpercent' WHERE id='$id'");
}
$sql="INSERT INTO lvl_log (id, ip)
VALUES('".$id."', '".$ip."')";
mysql_query($sql,$con);
}