Portál AbcLinuxu, 26. prosince 2025 19:53
$sth = DBI->connect('DBI:mysql:databaze', 'user', 'pass');
$sth = $dbh->prepare('SELECT hodnota FROM tabulka ORDER BY raditpodle');
$dbh->execute;
$soucet = 0;
$mezisoucet = 0;
$i = 0;
while (($hodnota) = $dbh->fetchrow_array) {
print "$hodnota\n";
$soucet += $hodnota;
$mezisoucet += $hodnota;
$i++;
if ($i % 5 == 0) {
print "mezisoucet = $mezisoucet\n";
$mezisoucet = 0;
}
}
print "soucet = $soucet\n"
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.