Update Bootstrap Card Data realtime [PHP/MYSQL]

I programmed a Dashboard with Bootstrap to show data from MySql

But i need show the data realtime on this div from select without refreshing brownser. So i'm looking a way to do it

<div class="col-md-4">
                <div class="card text-white bg-dark mb-3" style="max-width: 100%;">
                 <div class="card-header">Total Clientess / Ano</div>
                    <div class="card-body" id="sombra">
                        <h5 class="card-title" style="text-align:center;font-size: 40px;">

                            <?php 
                            
                              ## conecta no banco
                              include "conexao.php"; 

                              #da o comando sql no banco
                              $sql = "SELECT SUM(quantidade) AS total FROM clientes";

                              #Comando de consulta
                              $consulta = mysqli_query($conexao,$sql);

                              ## nao preciso de while pq ele vai pegar somente um valor, entao eu crio esse array
                              $dados = mysqli_fetch_array($consulta);
                             
                              #imprimo na tela o valor
                              echo $dados['total'];
                              
                             ?>
                             <span style="font-size: 20px">/ clientes</span>

                        </h5>
              
                    </div>
                    
                 </div>
              </div>

I will apreciate some help!



Read more here: https://stackoverflow.com/questions/64900662/update-bootstrap-card-data-realtime-php-mysql

Content Attribution

This content was originally published by Erick Amoedo at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: