以前、下記内容で質問をさせていただいたものです。
・「SELECT文とパラメータの引き継ぎ」
https://teratail.com/questions/12548?sip=n0070000_019&uid=27634
前回のご回答の件で、無事タスクは表示されるようになりました。
そのための考え方もつかめました。
次に考えているのは、カレンダーページ(index.php)の日付リンクから、その日のタスクのみを取得する処理をかきたくおもいます。
ちなみに、現段階はこういったものになってます。
lang
1<?php 2require_once('dbconnect.php'); 3// 年月日のパラメータを取得する。 4$ymd = isset($_GET['ymd']) ? $_GET['ymd'] : date("Y-m-d"); 5// タスクの配列を準備 6$task = ""; 7$taskData = array(); 8// PHP->MySQLtable 9// タスクのパラメータを送れるようにしたい。 10$query = $mysqli->query(" SELECT * FROM tasks"); 11// エラー処理 12if (!$query) { 13 die('クエリーが失敗しました。'.mysql_error()); 14} 15while ($row = $query->fetch_assoc()) { 16 // 各メンバ取得 17 $id = $row['id']; 18 $title = $row['title']; 19 $task_date = $row['task_date']; 20 $place = $row['place']; 21 $memo = $row['memo']; 22 $task .= "<tr><td>${title}</td><td>${task_date}</td><td>${place}</td><td>${memo}</td></tr>"; 23} 24?> 25<!DOCTYPE html> 26<html lang="ja"> 27<meta charset="utf-8"> 28<title>Today | タスク一覧</title> 29<h1>タスク一覧</h1> 30<table border="1"> 31 <thead> 32 <tr> 33 <th>タイトル</th> 34 <th>日時</th> 35 <th>場所</th> 36 <th>メモ</th> 37 </tr> 38 </thead> 39 <tbody> 40 <tr> 41 <td><?php echo $task ?></a></td> 42 </tr> 43 </tbody> 44</table> 45<form action="edition.php"> 46 <input type="submit" value="イベントを編集する"> 47</form> 48<form action="delete.php"> 49 <input type="submit" value="イベントを削除する"> 50</form> 51<form action="index.php"> 52 <input type="submit" value="トップページへ戻る"> 53</form> 54</html>
タスクのパラメータを$_GETなどで送ることで、クリックされた日付のタスクを取得できるのではないかと考えておりますが、いかがでしょうか。
お力添えよろしくお願い致します。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/07/15 01:45