-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview_topic.php
118 lines (100 loc) · 3.25 KB
/
view_topic.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="forum.css" />
<script type="text/javascript" src="java.js" charset="ISO-8859"></script>
<title>Tópicos</title>
</head>
<body>
<?php
$host="localhost";
$username="root";
$password="";
$db_name="forum";
$tbl_name="forum_q";
mysql_connect("$host", "$username", "$password")or die("Erro na conexão!");
mysql_select_db("$db_name")or die("Não foi possível selecionar base de dados!");
$id=$_GET['id'];
$sql="SELECT * FROM $tbl_name WHERE id='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
?>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" class="borda2">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1" class="borda4">
<tr>
<td class="borda3"><strong><?php echo $rows['topic']; ?></strong></td>
</tr>
<tr>
<td class="borda3"><?php echo $rows['detail']; ?></td>
</tr>
<tr>
<td class="borda3"><strong>Por :</strong> <?php echo $rows['name']; ?></td>
</tr>
<tr>
<td class="borda3"><strong>Data/Hora : </strong><?php echo $rows['datetime']; ?></td>
</tr>
</table></td>
</tr>
</table>
<br />
<?php
$tbl_name2="forum_res";
$sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id'";
$result2=mysql_query($sql2);
while($rows=mysql_fetch_array($result2)){
?>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" class="borda2">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1" class="borda1">
<tr>
<td class="borda3"><strong>ID</strong></td>
<td class="borda3">:</td>
<td class="borda3"><?php echo $rows['a_id']; ?></td>
</tr>
<tr>
<td width="18%" class="borda3"><strong>Nome</strong></td>
<td width="5%" class="borda3">:</td>
<td width="77%" class="borda3"><?php echo $rows['a_name']; ?></td>
</tr>
<tr>
<td class="borda3"><strong>Resposta</strong></td>
<td class="borda3">:</td>
<td class="borda3"><?php echo $rows['a_answer']; ?></td>
</tr>
<tr>
<td class="borda3"><strong>Data/Hora</strong></td>
<td class="borda3">:</td>
<td class="borda3"><?php echo $rows['a_datetime']; ?></td>
</tr>
</table></td>
</tr>
</table><br />
<?php
} ?>
<br />
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" class="borda2">
<tr>
<form name="form1" method="post" id="res" action="add_res.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="borda1">
<tr>
<td valign="top"><strong>Resposta</strong></td>
<td valign="top">:</td>
<td><textarea name="a_answer" cols="45" rows="3" id="a_answer" ></textarea></td>
</tr>
<tr>
<td> </td>
<td><input name="id" type="hidden" value="<?php echo $id; ?>"/></td>
<td><input type="button" name="Submit" onclick="validaForm5 ()" value="Enviar"/> <input type="reset" name="Submit2" value="Limpar"/>
<input type="button" name="Submit3" value="Home" onclick="window.location.href='http://localhost/forum/usuario.php'"/>
</td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</body>
</html>