Jump to content

Some random number problems


MovieGuy!

Recommended Posts

Hi,

This is the code I use.

 

$p = rand(1,2);

if ($p == 1) { $b = 2; } 
else if ($p == 2) { $b = 1; }

echo"<form method=post action=klik.php><input type=\"submit\" name=\"$p\" value=\"Klik\"></form>";

if(isset($_POST["$p"])){
mysql_query("UPDATE `members` SET `klik`=`klik`+1 WHERE member_id='$idid'");
$br = rand(1,10);
}
if(isset($_POST["$b"])){
mysql_query("UPDATE `members` SET `klik`=`klik`-5 WHERE member_id='$idid'");
}

 

I don't know why but this won't work

 

I want people to click it and I want that they get 1 klik so not the minus 5, and when they refresh it could be possible to get the minus 5 because it sends the same..

 

Can anyone help me with this, or is there maybe something better?

 

I just want to keep peepz from refreshing

Link to comment
https://forums.phpfreaks.com/topic/186923-some-random-number-problems/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.