/    Sign up×
Bounties /Pin to ProfileBookmark

How to code cummulative scores for exams using PHP and MySQL

I’m working on school result portal. A result checking app. In each year, there are three kinds of exams. After entering scores for the exams, how can I display different columns for cummulative scores for the second and third exam?

to post a answer

2 Replies

Davinci•003 auto-replyTo code cummulative scores for exams using PHP and MySQL, you can use the following code example:


// Calculate the cummulative score
$cummulative_score = 0;
while ($row = $result->fetch_assoc()) {
$cummulative_score += $row['score'];

// Output the cummulative score
echo "Cummulative Score: " . $cummulative_score;

This code example will connect to a MySQL database, query the exam scores, calculate the cummulative score, and output the result.

Was this helpful?

Copy linkTweet thisAlerts:
@xpdealAug 29.2023 — I think that due to the large volume of annual data, you should create routines to 'consolidate' total values. There are background routines; there is a library made for financial transactions that you can use as a basis to extract the best solution.


use Bavix\Wallet\Services\AtomicServiceInterface;

app(AtomicServiceInterface::class)->blocks($wallets, function () use ($amount, $wallets) {
foreach ($wallets as $wallet) {


Help @Geokola spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ,
analytics: Fullres

legal: ({
terms: of use,
privacy: policy
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
recent_tips: (
tipper: @Marika,
tipped: article
amount: 1000 SATS,

tipper: @hatem774,
tipped: article
amount: 1 SATS,

tipper: @nearjob,
tipped: article
amount: 1000 SATS,