hallo in die runde,
wie kann ich gleiche vorkommnisse in einer datenbank (autorid) zählen lassen und ausgeben (im template)?
PHP-Code:
<?php $database = \Database::getInstance(); ?>
<?php $anzahl = $database->prepare('SELECT *, COUNT(autorid) FROM mm_gruppenarchiv_kommentare')->execute(); ?>
so richtig scheint das nicht zu funktionieren.
wie komme ich dann über die variable anzahl an die gezählte anzahl? hat jemand eine idee?
die aktuelle ausgabe über print_r sieht so aus:
Code:
Contao\Database\Mysqli\Result Object
(
[resResult:protected] => mysqli_result Object
(
[current_field] => 0
[field_count] => 12
[lengths] =>
[num_rows] => 1
[type] => 0
)
[strQuery:protected] => SELECT *, COUNT(autorid) FROM mm_gruppenarchiv_kommentare
[intIndex:Contao\Database\Result:private] => -1
[blnDone:Contao\Database\Result:private] =>
[blnModified:Contao\Database\Result:private] =>
[arrCache:protected] => Array
(
)
)
lg.
alex
Lesezeichen