質問編集履歴
1
アドバイスを受け、更新致しました。
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -64,4 +64,65 @@
|
|
|
64
64
|
</table>
|
|
65
65
|
<p><a href="index.php">追加画面に戻る</a></p>
|
|
66
66
|
</html>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
追記:皆様ご回答ありがとうございます。まとめてみたところ、以下のような記述となりました。
|
|
71
|
+
ですが、表示はされません。
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
```lang-PHP
|
|
75
|
+
<?php
|
|
76
|
+
require_once('dbconnect.php');
|
|
77
|
+
// 年月日のパラメータを取得する。
|
|
78
|
+
$ymd = isset($_GET['ymd']) ? $_GET['ymd'] : date("Y-m-d");
|
|
79
|
+
// タスクの配列を準備
|
|
80
|
+
$task = "";
|
|
81
|
+
$taskData = array();
|
|
82
|
+
// PHP->MySQLtable
|
|
83
|
+
// タスクのパラメータを送れるようにする。
|
|
84
|
+
$query = $mysqli->query(" SELECT * FROM tasks WHERE task_date = '$ymd' ");
|
|
85
|
+
// エラー処理
|
|
86
|
+
if (!$query) {
|
|
87
|
+
die('クエリーが失敗しました。'.mysql_error());
|
|
88
|
+
}
|
|
89
|
+
while ($row[] = $query->fetch_assoc()) {
|
|
90
|
+
// 各メンバ取得
|
|
91
|
+
$taskData[] = array(
|
|
92
|
+
'id'=>$row['id'],
|
|
93
|
+
'title'=>$row['title'],
|
|
94
|
+
'task_date'=>$row['task_date'],
|
|
95
|
+
'place'=>$row['place'],
|
|
96
|
+
'memo'=>$row['memo']
|
|
97
|
+
);
|
|
98
|
+
// タスクを表示形式に設定
|
|
99
|
+
$task .= "<td>".$row."</td>";
|
|
100
|
+
}
|
|
101
|
+
?>
|
|
102
|
+
<!DOCTYPE html>
|
|
103
|
+
<html lang="ja">
|
|
104
|
+
<meta charset="utf-8">
|
|
105
|
+
<title>Today | タスク一覧</title>
|
|
106
|
+
<table border="1">
|
|
107
|
+
<thead>
|
|
108
|
+
<tr>
|
|
109
|
+
<th>タイトル</th>
|
|
110
|
+
<th>日時</th>
|
|
111
|
+
<th>場所</th>
|
|
112
|
+
<th>メモ</th>
|
|
113
|
+
</tr>
|
|
114
|
+
</thead>
|
|
115
|
+
<tbody>
|
|
116
|
+
<?php foreach ($taskData as $row): ?>
|
|
117
|
+
<tr>
|
|
118
|
+
<td><?= htmlspecialchars($row['title']) ?></td>
|
|
119
|
+
<td><?= htmlspecialchars($row['task_date']) ?></td>
|
|
120
|
+
<td><?= htmlspecialchars($row['place']) ?></td>
|
|
121
|
+
<td><?= htmlspecialchars($row['memo']) ?></td>
|
|
122
|
+
</tr>
|
|
123
|
+
<?php endforeach; ?>
|
|
124
|
+
</tbody>
|
|
125
|
+
</table>
|
|
126
|
+
<p><a href="index.php">追加画面に戻る</a></p>
|
|
127
|
+
</html>
|
|
67
128
|
```
|