-
Notifications
You must be signed in to change notification settings - Fork 0
/
teste.php
32 lines (23 loc) · 934 Bytes
/
teste.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
//Arquivo de Testes para Conexão
require_once 'conexao.php';
$con = conexao();
$query = "SELECT p.nome AS NomeProduto, p.descricao AS Descricao, p.preco AS PrecoOriginal, f.tipo AS TipoFoto, d.valor AS ValorDesconto, d.dataFim AS DataFinal
FROM produto AS P INNER JOIN descontos AS d ON p.id_desconto = d.id
INNER JOIN fotos as f ON p.id_foto = f.id";
$stmt = $con->prepare($query);
$stmt->execute();
/*
while($row = $stmt->fetch(PDO::FETCH_OBJ)){
echo $row->id . "<br/>";
echo $row->valor . "<br/>";
echo $row->nome . "<br/>";
echo $row->dataFim . "<br/>";
}
*/
$row = $stmt->fetch(PDO::FETCH_OBJ);
var_dump($row);
/* SELECT p.nome AS NomeProduto, p.descricao AS Descricao, p.preco AS PrecoOriginal, f.tipo AS TipoFoto, d.valor AS ValorDesconto, d.dataFim AS DataFinal
FROM produto AS P INNER JOIN descontos AS d ON p.id_desconto = d.id
INNER JOIN fotos as f ON p.id_foto = f.id;
*/