Hi everyone hopefully my code bellow does the following, but wounderd if this is the correct way to go through each row and update each user
[code=php]<?
//connect to building database
$result = mysql_query(“SELECT * FROM buildup”)
or die(mysql_error());
$row = mysql_fetch_array( $result )
//some variables of time
$expiry = $row[“endtime”];
$now = time();
$upgrade=’bank’;
$buildingnumber = $upgrade
//if endtime has passed time update there building
if($expiry < $now){
mysql_query(“UPDATE users SET $buildingnumber=$buildingnumber+’1′”);
echo “Updated building Successfully”;
mysql_query(“DELETE FROM buildup WHERE $expiry < $now”);
echo “Deleted and updated Successfully”;
}
elseif($expiry > $now){
echo “Nothing to update”;
}else {
echo “Error! Thats not good”;
}
?>
is this the best efficant way of doing this, would this go through each row and do the above.
thanks to anyone that helps ?