Jnnbo: Ich hab es - Meine Lösung

Beitrag lesen

Hallo,

ich habe eine zweite Funktion erstellt:

		function produkteCount($mysqli) {
		$stmt = $mysqli->prepare("SELECT count(p_id) as total, p_id 
									FROM web_produkte");
		$stmt->execute();
		$stmt->bind_result($total, $p_id);
		$stmt->store_result();
	 	
		if($stmt->num_rows() >  0) {     
			while ($stmt->fetch()){
				$produkteCount[] = array( 
					'total' 				=> $total,
					'p_id'			=> $p_id
				);
			}
			return $produkteCount;
			
			}
	}

Und die Ausgabe dann so:

$produkteCount = produkteCount($mysqli);

foreach($produkteCount as $arrayCount){ 
echo $arrayCount['total'];
}

anderes bekomme ich es nicht hin