-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmostraTodosVistos.php
71 lines (64 loc) · 1.58 KB
/
mostraTodosVistos.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<html>
<head>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<title>Todos os Filmes</title>
</head>
<body style="background-image:url(http://web.ist.utl.pt/ist170438/aux/fundo.jpg)">
<center>
<font size="5" color = "blue" ><b>Todos os Filmes</b></font>
<br>
<br>
<form action="http://web.ist.utl.pt/ist170438/aux/mymdb.php">
<input type="submit" class="css_btn_class3" value="Inicio">
</form>
<br>
<?php
try
{
$nomeP= $_REQUEST['nomeP'];
$host = "xxxxx";
$user ="xxxxx";
$password = "xxxxx";
$dbname = $user;
$db = new PDO("mysql:host=$host;dbname=$dbname", $user, $password);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "SELECT * FROM Filme RIGHT JOIN FilmesVistos on Filme.nomeF = FilmesVistos.nomeF WHERE FilmesVistos.nomeP = '$nomeP' ;";
$result = $db->query($sql);
$pos = 0;
echo '<table>';
echo("<table border=\"5\" bordercolor=\"eeeeee\" cellspacing=\"5\">\n");
foreach ($result as $row)
{
if($pos == 0)
echo '<tr>';
if($pos < 6){
echo '<td>
<a href="infoDetalhada.php?nomeF='.$row['nomeF'].'" target="_self"><img
src="'.$row['idImdb'].'"
width="250" height="375"
alt="'.$row['nomeF'].'"
/></a>
</td>';
$pos++;
}
if($pos == 6){
echo '</tr>';
$pos = 0;
}
}
if($pos < 6)
echo '</tr>';
echo '</table>';
$db = null;
}
catch (PDOException $e)
{
echo("<p>ERROR: {$e->getMessage()}</p>");
}
?>
<br>
<br>
<br>
</center>
</body>
</html>