Hello, i have the below cronjob that looks at the database "buildup" and finds all the things that have finnished. then if they have finnished it +1 on the building it has.
how can i delete each row after it has gone through each one of the database. so once it has done a row it deletes it, then the next then deletes it etc.
thanks to anyone that helps mePHP Code:<?php
//Create Funcion: buildup_cron
function buildup_cron() {
$timeStamp = time();
$result = mysql_query("SELECT * FROM buildup WHERE endtime<'$timeStamp'");
while($row = mysql_fetch_array($result)) {
if($row['building'] == 1)
$upgrade= "bank";
elseif($row['building'] == 2)
$upgrade= "house";
elseif($row['building'] == 3)
$upgrade= "harbour";
elseif($row['building'] == 4)
$upgrade= "temple";
else
echo "error, doh!";
mysql_query("UPDATE users SET $upgrade=$upgrade+'1' WHERE id='$row[userid]'");
}
}
//run cron
buildup_cron();
?>![]()


Reply With Quote
Bookmarks