php if _POST dfile mass _POST dfile while mass link mysql_connect loca

 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
<?php
if($_POST["dfile"])
{ $mass=$_POST["dfile"];
$i=0;
while($mass[$i])
{
$link = mysql_connect("localhost", "root","")
or die("Could not connect");
mysql_select_db("MKD") or die("Could not select database");
$s1="Select * FROM `Data_in` WHERE ID=$mass[$i]";
$result1 = mysql_query($s1) or die("Query failed");
$i++;
}
$line = mysql_fetch_row($result1);
echo '<pre>';
var_dump($line );
echo '</pre>';
die;
//Header("Location: uspex.php?i=2");
}
?>
<html>
<HEAD>
<META http-equiv=content-type content="text/html; charset=windows-1251">
</HEAD>
<body >
<br><br><br><br><br>
<center><h2>Данные</h2></center>
<form method="post" action="new2.php" >
<table align="center"border=1>
<tr align="center">
<td>Автор</td>
<td>Факультет</td>
<td>Специальность</td>
<td>Название</td>
<td>Кафедра</td>
<td>Дисциплина</td>
<td>Файл<td>
</tr>
<?php
$link = mysql_connect("localhost", "root","")
or die("Could not connect");
mysql_select_db("MKD") or die("Could not select database");
$query="SELECT * FROM `Data_in`";
$result = mysql_query($query) or die("Query failed");
while ($line = mysql_fetch_row($result)) {
print "<tr align=\"center\"><td>$line[1]</td>";
print "<td>$line[2]</td>";
print "<td>$line[3]</td>";
print "<td>$line[4]</td>";
print "<td>$line[5]</td>";
print "<td>$line[6]</td>";
print "<td><a href=/uploads/$line[7]>File</a><td>";
print "<td>";
$v=$line[0];
?>
<input type=checkbox name=dfile[] value= "<?php echo $v ?>" >
<?php
print "</td></tr>";
} ?>
</table>
<br>
<center><input type=submit name="ud" value=Показать></center>
</form>
</body>
</html>