Alright, I'm trying to make it so that someone can vote for a "server" every 24 hours, but currently, I'm stuck here:
function vote1() {
$pull = $_SERVER['REMOTE_ADDR'];
$votersIp = "select votersIp from voters";
$usersIp = $_SERVER['REMOTE_ADDR'];
$fetch = mysql_query("SELECT * FROM voters WHERE votersIp = '".$_SERVER['REMOTE_ADDR']."'");
while($rude = mysql_fetch_array($fetch)){
if($rude[votersIp] != $pull) {
$zoot="INSERT INTO voters (votersIp, lastVoted) VALUES ('$usersIp', '0')";
mysql_query($zoot) or die ( mysql_error() );
echo 'Voters IP not in database'; //debugging
}
if($rude[votersIp] = $pull) {
echo 'found ip'; //debugging
}
}
So, if you can't tell, I'm trying to make it so that everytime someone votes, it adds their IP address to the database. I know I'm doing something very basic wrong here, but I'm still learning.
I would appreciate it if you could post the fix, but also explain what I'm doing wrong, and any suggestions would be great as well.
Thank you!