forked from AdelinedeNazare/MaisHistoria
-
Notifications
You must be signed in to change notification settings - Fork 0
/
artigo.php
57 lines (50 loc) · 1.91 KB
/
artigo.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
include_once 'connection.php';
?>
<!DOCTYPE html>
<html lang="pt-br">
<body>
<header>
<?php
include_once 'login.php';
include_once 'menu.php';
?>
</header>
<div class="container conteudo">
<?php
include_once 'carrosel.php';
?>
<div class="row destaque">
<h2 style="color:#005858;">Artigos:</h2>
<hr>
</div>
<?php
$query = "SELECT * FROM tb_artigos JOIN tb_assunto ON tb_artigos.tb_assunto_idassunto = tb_assunto.idassunto;";
$artigo = $conn->query($query);
if ($artigo->num_rows) {
$tabela = '<table border="1" class="table table-striped">';
$tabela .= '<thead>';
$tabela .= '<tr> ';
$tabela .= '<th class="warning" col-md-1>#ID</th> ';
$tabela .= '<th class="warning" col-md-4>Nome do Artigo </th> ';
$tabela .= '<th class="warning" col-md-4>Acesse aqui o artigo </th> ';
$tabela .= '</tr>';
$tabela .= '<tr>';
foreach ($artigo as $resultado) {
$idProfessor = $resultado['professor_idprofessor'];
$idArtigo = $resultado['id_artigos'];
$tabela .= "<td class='info col-md-1'>$idArtigo</td>";
$tabela .= '<td class="info col-md-8">' .$resultado['nome'] . '</td>';
$tabela .= "<td class='info col-md-3'><a href='artigomostrar.php?id=$idArtigo'>Acesse</a></td>";
$tabela .= '</tr>';
$tabela .= ' </thead>';
}
echo $tabela;
} else {
header("Location: http://localhost/error.php");
die();
}
?>
<br> </div>
</body>
</html>