aktueller monat komplett in der aktuellen sprache:
Code: Alles auswählen
<?php
// aktuelles monat gesamt in aktueller sprache
$sql = 'SELECT
sum(B.visited) as visited
FROM
'.$cfg['tab']['stat'].' as B
WHERE
B.idlang = '.$lang;
$db->query($sql);
if ($db->next_record()) {
echo "Aktuelles Monat komplett: ".$db->f('visited');
}
?>
Code: Alles auswählen
<?php
// letztes monat gesamt in aktueller sprache
$year = date("Y");
$month = date("m");
if ($month == 1)
{
$month = 12;
$year = $year -1;
} else {
$month = $month -1;
}
$yearmonth = sprintf("%04d%02d",$year,$month);
$sql='SELECT
sum(C.visited) AS archived
FROM
'.$cfg['tab']['stat_archive'].' AS C
WHERE
C.idlang = '.$lang.' AND
C.archived = '.$yearmonth;
$db->query($sql);
if ($db->next_record()) {
echo 'Letztes Monat komplett: '.$db->f('archived');
}
?>
Code: Alles auswählen
<?php
// gesamt in aktueller sprache
$sql = 'SELECT
sum(B.visited) as visited
FROM
'.$cfg['tab']['stat'].' AS B
WHERE
B.idlang = '.$lang;
$db->query($sql);
if ($db->next_record()) {
$hits = $db->f('visited');
}
$sql='SELECT
sum(C.visited) AS archived
FROM
'.$cfg['tab']['stat_archive'].' AS C
WHERE
C.idlang = '.$lang;
$db->query($sql);
if ($db->next_record()) {
$hits = $hits + $db->f('archived');
}
echo "Insgesamte Hits: ".$hits;
?>
wenn du das ganze vielleicht in ein nettes modul zusammenfassen könntest, wäre es sicher ganz brauchbar...