質問編集履歴

3

前の例題分を入力しました

2018/11/15 14:12

投稿

kakko
kakko

スコア13

test CHANGED
File without changes
test CHANGED
@@ -32,30 +32,134 @@
32
32
 
33
33
  ソースコード
34
34
 
35
+
36
+
35
- ```
37
+ //前の例題分 表作成 エラーは表示されていません
36
-
38
+
37
- ```html<!DOCTYPE html>``````html
39
+ <!DOCTYPE html>
38
-
39
- コード
40
+
40
-
41
-
42
-
43
- ```
44
-
45
- <html>```html
41
+ <html>
46
-
47
- コード
48
-
49
- ```
50
-
51
-
52
-
53
-
54
42
 
55
43
  <head>
56
44
 
57
45
  <meta charset="UTF-8"/>
58
46
 
47
+ <title>11-1</title>
48
+
49
+ </head>
50
+
51
+ <body>
52
+
53
+ <?php
54
+
55
+ $dbname= "sqlite:pdd.db";
56
+
57
+ $username= "";
58
+
59
+ $psword= "";
60
+
61
+
62
+
63
+ $db= new PDO($dbname,$username,$psword);
64
+
65
+ $db->exec("DROP TABLE IF EXISTS product");
66
+
67
+ $db->exec("CREATE TABLE product(id INTEGER PRIMARY KEY,name STRING,price INTEGER)");
68
+
69
+
70
+
71
+ $qry=array(
72
+
73
+ "INSERT INTO product (name, price) VALUES('鉛筆', 80)",
74
+
75
+ "INSERT INTO product (name, price) VALUES('消しゴム', 50)",
76
+
77
+ "INSERT INTO product (name, price) VALUES('定規', 200)",
78
+
79
+ "INSERT INTO product (name, price) VALUES('コンパス', 300)",
80
+
81
+ "INSERT INTO product (name, price) VALUES('ボールペン', 100)"
82
+
83
+ );
84
+
85
+ foreach($qry as $value){
86
+
87
+ $db->exec($value);
88
+
89
+ }$qry="SELECT * FROM product";
90
+
91
+ $data= $db->query($qry);
92
+
93
+ ?>
94
+
95
+
96
+
97
+ <table border="2">
98
+
99
+ <tr bgcolor="#AAAAAA">
100
+
101
+ <th>番号</th>
102
+
103
+ <th>商品名</th>
104
+
105
+ <th>単価</th>
106
+
107
+ </tr>
108
+
109
+
110
+
111
+ <?php
112
+
113
+ while($value = $data->fetch()){
114
+
115
+ $id = $value["id"];
116
+
117
+ $name = $value["name"];
118
+
119
+ $price = $value["price"];
120
+
121
+ print "<tr><td>{$id}</td><td>{$name}</td><td>{$price}</td></tr>\n";
122
+
123
+ }
124
+
125
+ $db = null;
126
+
127
+ ?>
128
+
129
+
130
+
131
+ </table>
132
+
133
+ </body>
134
+
135
+ </html>
136
+
137
+ ```
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+ ```html<!DOCTYPE html>````html
154
+
155
+ //これから下がエラーがでている分
156
+
157
+ <html>`
158
+
159
+ <head>
160
+
161
+ <meta charset="UTF-8"/>
162
+
59
163
  <title>11-6</title>
60
164
 
61
165
  </head>
@@ -64,6 +168,10 @@
64
168
 
65
169
  ```
66
170
 
171
+
172
+
173
+ ```
174
+
67
175
  ```php
68
176
 
69
177
  <?php

2

コードのマークを修正しました

2018/11/15 14:12

投稿

kakko
kakko

スコア13

test CHANGED
File without changes
test CHANGED
@@ -32,11 +32,25 @@
32
32
 
33
33
  ソースコード
34
34
 
35
- ```HTML
35
+ ```
36
-
36
+
37
- <!DOCTYPE html>
37
+ ```html<!DOCTYPE html>``````html
38
+
38
-
39
+ コード
40
+
41
+
42
+
43
+ ```
44
+
39
- <html>
45
+ <html>```html
46
+
47
+ コード
48
+
49
+ ```
50
+
51
+
52
+
53
+
40
54
 
41
55
  <head>
42
56
 
@@ -94,9 +108,9 @@
94
108
 
95
109
  ```
96
110
 
97
-
98
-
99
- ```css
111
+ ```html
112
+
113
+
100
114
 
101
115
  <table border="2">
102
116
 

1

ソースコードにマークダウンのcode機能を利用 表示したいものを試したいものに移動

2018/11/15 13:34

投稿

kakko
kakko

スコア13

test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,7 @@
32
32
 
33
33
  ソースコード
34
34
 
35
- ```
35
+ ```HTML
36
36
 
37
37
  <!DOCTYPE html>
38
38
 
@@ -48,6 +48,10 @@
48
48
 
49
49
  <body>
50
50
 
51
+ ```
52
+
53
+ ```php
54
+
51
55
  <?php
52
56
 
53
57
 
@@ -88,9 +92,13 @@
88
92
 
89
93
  ?>
90
94
 
91
-
95
+ ```
96
+
97
+
98
+
92
-
99
+ ```css
100
+
93
- <table border="2">
101
+ <table border="2">
94
102
 
95
103
  <tr bgcolor="#AAAAAA">
96
104
 
@@ -102,7 +110,11 @@
102
110
 
103
111
  </tr>
104
112
 
105
-
113
+ ```
114
+
115
+
116
+
117
+ ```php
106
118
 
107
119
  <?php
108
120
 
@@ -138,6 +150,10 @@
138
150
 
139
151
 
140
152
 
153
+ ```
154
+
155
+ ```html
156
+
141
157
  </table>
142
158
 
143
159
  <form action="http://localhost/YPHPSample/11/Sample11-6.php" method="post">
@@ -152,14 +168,18 @@
152
168
 
153
169
  </html>
154
170
 
155
-
171
+ ```
172
+
173
+
174
+
175
+
176
+
177
+
178
+
156
-
179
+ ## 試したこと
157
-
158
180
 
159
181
  表示したいもの
160
182
 
161
-
162
-
163
183
  番号 商品名 単価
164
184
 
165
185
  1 鉛筆 80
@@ -174,9 +194,7 @@
174
194
 
175
195
    × 検索
176
196
 
177
- ## 試したこと
197
+ 試したこと
178
-
179
-
180
198
 
181
199
  いろいろ検索しました
182
200