says user doesnt exist. SQL
Posted: Sun Mar 26, 2006 9:15 pm
first im deleting records that expire past 24 hours. is
86400
the correct number for 24 hours?
second $hit = 1 and looking at my sql tools it shows the record there with an id of 1
the full code
86400
the correct number for 24 hours?
second $hit = 1 and looking at my sql tools it shows the record there with an id of 1
Code: Select all
$result = mysql_query( "SELECT * FROM whh_members WHERE id='$hit'" );//
$row=mysql_fetch_array($result); //Store Record Of Data in $row
print $row['id'];the full code
Code: Select all
$hostname = $_SERVER['REMOTE_ADDR'];
$timeout = time() - 86400; //24 hours
$thetime = time();
//delete people that havnt visited in 24 hours.
mysql_query("DELETE FROM whh_last_click WHERE Whenn < $timeout");
//find out if user allready visited users link within 24 hours
$result = mysql_query( "SELECT * FROM whh_last_click WHERE ip='$hostname' AND member_id='$hit'" );//
$row=mysql_fetch_array($result); //Store Record Of Data in $row
//if user hasnt visited within 24 hours add to database
if ($row['id'] == "")
{
$result = mysql_query( "SELECT * FROM whh_members WHERE id='$hit'" );//
$row=mysql_fetch_array($result); //Store Record Of Data in $row
print $row['id'];
if ($row['id'] <> "")
{
//add when user got last click from member id
mysql_query ("INSERT INTO whh_last_click(ip,member_id,whenn) VALUES ('$hostname','$hit','$thetime')") or die(mysql_error());
$wh = $row['wh'] + 10;
//update wh
mysql_query ("UPDATE whh_members SET wh='$wh' WHERE id='$hit'") or die(mysql_error());
print '<br><p align="center"><strong>You have given this user 10$WH. </strong></p>';
}
else
{
print '<br><p align="center"><strong>User does not exist. </strong></p>';
}
}
else
{
print '<br><p align="center"><strong>You have allready given this user 10$WH within the last 24 hours.</strong></p>';
}