Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Conexão com Banco de Dados
- require_once "conexao.php";
- //Executa o SQL selecionando todos os campos da tabela produtos
- $query = mysql_query("SELECT * FROM produtos");
- ?>
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Document</title>
- </head>
- <body>
- <?php while ($row = mysql_fetch_assoc($query)) : ?>
- <form action="carrinho.php">
- <img src="image/<?php echo $row['imagem'] ?>" />
- <h2><?php echo $row['nome']; ?></h2>
- <p>Preço : R$<?php echo number_format($row['preco'], 2, ',', '.') ?></p>
- <!-- ID do Produto pra adicionar no carrinho-->
- <input type="hidden" name="id" value="<?php echo $row['id'] ?>" />
- <button type="submit">Adicionar ao Carrinho</button>
- </form>
- <?php endwhile; ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement