PHP-Code:
<?
$dbQuery = "select * from sites";
$result = mysql_query( $dbQuery, $connectionID);
while ($ds = @mysql_fetch_array($result))
{
$id = $ds["id"];
$date = $ds["date"];
$count = $ds["count"];
$quotient = $ds["quotient"];
$datumVon = "$date";
$datumBis = (date("d/m/Y G:i:s"));
$myArrayDatumVon = explode("/", $datumVon);
$datumVon = mktime(0,0,0,$myArrayDatumVon[1],$myArrayDatumVon[0],$myArrayDatumVon[2]);
$myArrayDatumBis = explode("/", $datumBis);
$datumBis = mktime(0,0,0,$myArrayDatumBis[1],$myArrayDatumBis[0],$myArrayDatumBis[2]);
$differenztage = ($datumBis-$datumVon) / (3600*24);
$unrounded = ($count) / ($differenztage);
$quotient = round($unrounded,'2');
$dbQuery = "update sites set quotient=\"".$quotient."\" where id='$id' ";
$result = mysql_query( $dbQuery, $connectionID);
}
?>
Wieso wird hier nur der erste wert upgedatet und nicht alle die in der datenbank sind?
Kommentar