Bernd: gesamte Anzahl auslesen

Beitrag lesen

Hallo,

ist es möglich obwohl ich ein LIMIT in einer Abfrage habe, die Gesamtmenge zu bekommen? Meine Funktion schaut derzeit wie folgt aus

function Artikel($mysqli, $code) {
    
        $stmt = $mysqli->prepare("

            SELECT a_id, a_code, a_titel ma_id, ma_titel  
            FROM artikel 
            LEFT JOIN marken ON marken.ma_id = artikel.a_programm 
            WHERE a_katID=? AND a_status = 1 ORDER BY RAND() LIMIT 5");

        $stmt->bind_param("s", $code);
        $stmt->execute();
        $stmt->bind_result($a_id, $a_code, $a_titel $ma_id, $ma_titel);
                
        $stmt->store_result();

            if($stmt->num_rows() >  0) {     
                while ($stmt->fetch()){
                    $Artikel[] = array( 
                        'a_id'                      => $a_id, 
                        'a_code'                    => $a_code,
                        'a_titel'                   => $a_titel,
                        'ma_id'                     => $ma_id,
                        'ma_titel'                  => $ma_titel
                    );
                }

            return $Artikel;
        }
    }