I have a DIV call ( meusBotoes
) and I would like every loop
of while
to generate a button within the DIV
with the value of the variable $nome
and with the onclick
it calls the function displayAlerta ().
My while
<?php
$host = "";
$bd = "";
$usr = "";
$psw = "";
$conn = new mysqli($host, $usr, $psw, $bd);
if ($conn->connect_error)
{
die("A conexão falhou, consulte o suporte: " . $conn->connect_error);
}
$sql = "SELECT id, nome, tipo, imagem FROM produtos";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{
while($row = $result->fetch_assoc())
{
$id = $row['id'];
$nome = $row['nome'];
$tipo = $row['tipo'];
$imagem = $row['imagem'];
}
}
?>
Is there an easy way to do this in% with% of same, without% with%?