質問編集履歴
1
コードを追加した
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,72 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
2
|
+
|
3
|
+
<html>
|
4
|
+
|
5
|
+
<head>
|
6
|
+
|
1
|
-
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
8
|
+
|
9
|
+
<title>php remaster</title>
|
10
|
+
|
11
|
+
</head>
|
12
|
+
|
13
|
+
<body>
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
<?php
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
function db_connect($db,$bango){
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
$link = mysqli_connect('localhost','root','pass');
|
26
|
+
|
27
|
+
if (!$link) {
|
28
|
+
|
29
|
+
die('接続できませんでした: ' . mysqli_error($link));
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
$db_selected = mysqli_select_db($link,'mondai');
|
34
|
+
|
35
|
+
if (!$db_selected){
|
36
|
+
|
37
|
+
die('データベース選択失敗です。'.mysqli_error($link));
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
mysqli_set_charset($link,'utf8');
|
42
|
+
|
43
|
+
$result = mysqli_query($link,'SELECT bango,mondai,sentaku1,sentaku2,sentaku3,sentaku4,kaisetu,seikai,bunya FROM'.$db.'where bango ='.$bango);
|
44
|
+
|
45
|
+
if (!$result) {
|
46
|
+
|
47
|
+
die('!!!!クエリーが失敗しました。'.mysqli_error($link));
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
$data = mysqli_fetch_assoc($result);
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
return $data;
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
?>
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
</body>
|
68
|
+
|
69
|
+
</html>
|
2
70
|
|
3
71
|
|
4
72
|
|