How to sum of variable using while loop in [ PHP ]

[dm_code_snippet background=”yes” background-mobile=”yes” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no”]

<?php

$data = 0;
while($get_row = mysqli_fetch_assoc($get_result)){

$data+= $get_row [‘col_data’];
}

echo $data;

?>

[/dm_code_snippet]

Leave a Reply

Your email address will not be published. Required fields are marked *