Or, perhaps is there a way to just add 500 to the current total of credits by using the mysql update?
Code: Select all
<?php
include_once('../inc/connect.php');
$date = date("Y-m-d");
$drawquery = mysql_query("SELECT id FROM userstats WHERE `todaysurfed`>=250 AND DATEDIFF(NOW(),`wondaily`) > 30 OR `wondaily`='0000-00-00' ORDER BY rand() LIMIT 3");
while($row = mysql_fetch_array($drawquery))
{
$userid = $row['id'];
$credits = $row['credits'];
$addcredits = 500;
$newcredits = $credits + $addcredits;
echo $userid."<br />";
$updatewinners = mysql_query("UPDATE userstats SET wondaily='$date', credits='$newcredits' WHERE id='$userid'");
}
?>
Thanks