Portál AbcLinuxu, 1. června 2025 16:49
$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.