-1
Good morning to all,
Was using query with mysqli and returning to card in bootstrap, follows code snippet.
<?php
require_once("conectar.php");
$comando = "SELECT * FROM agendamentos ORDER BY id DESC";
$enviar=mysqli_query($conn, $comando);
$resultado = mysqli_fetch_all($enviar, MYSQLI_ASSOC);
?>
<?php
foreach ($resultado as $agendamentos ) {
$id=$agendamentos['id'];
$user=$agendamentos['user'];
$telefone=$agendamentos['telefone'];
$data=$agendamentos['data'];
?>
CARD BOOTSTRAP
<div class="card-deck" style="display: inline-grid;">
<div class="col-md-offset-1 col-md-6 col-xs-12">
<div class="card border-primary mb-3" style="width: 21rem;">
<center>
<div class="card-header"><strong><?=$user?></strong></div>
<div class="card-body text-primary">
<h5 class="card-title"><strong><?=$data?></strong></h5>
<p class="card-text">telefone:<br><?=$telefone?></p>
</div>
</center>
</div>
</div>
</div>
<?php
}
?>
I preferred to change my code to PDO and want to ixibir the data in the same way.
So far I was able to list the data, but as I had already said I want the return of the data in the same way I had done with the query msqli.
<?php
require 'conexao.php';
$consulta = $pdo->query("SELECT user, data, telefone FROM agendamentos;");
while ($linha = $consulta->fetch(PDO::FETCH_ASSOC)) {
echo "Empresa: {$linha['user']} - Telefone: {$linha['telefone']} - Data: {$linha['data']}<br />";
}
?>
thank you so much for the response, I was trying in other ways.
– Vinicius Pereira