$link = mysql_connect('localhost', 'root', ''); $db = mysql_select_db('test',$link);
$arr = array('Buildings','Research','fleets');
foreach($arr as $v) {
$sql = "UPDATE `$v` SET `Action Name` = `Action Name`+1 WHERE `Action Time` >= 1";
if (mysql_query($sql)) {
echo "$v updated";
}
}
$sql = "UPDATE `jobs` SET `Action Time`=`Action Time`-1 WHERE `Action Time` >= 1";
if (mysql_query($sql)) {
echo "jobs updated";
}
updates the jobs correctly and leaves them at 0 (good thing.)
but DOES NOT update the metal mine or others in "buildings" "research" or "ship"
I never get "$v updated"..
can you please help me incorperate (echo *mysql_error* ?
=========edit
how can I put:
DELETE FROM `jobs` WHERE `jobs`.`Action Time` = 0;
DELETE FROM `jobs` WHERE `jobs`.`Action Time` = 1;
into the source AFTER the updating times and buidlings step?