Commit dfde8e78 authored by 君塚 悠's avatar 君塚 悠

プログラム作製(schedule_delete.php,schedule_read.php,schedule_record.php,schedule_record2.php:データベース)

parent 5e975caf
<?php
//データベースへの接続
$db = sqlite_open("schedule.sqlite", 0666, $err);
//SQL命令の発行
sqlite_query($db, "DELETE FROM schedule WHERE sid ='".sqlite_escape_string($_GET['sid'])."'");
//データベースの切断
sqlite_close($db);
header("Location: schedule_read.php");
?>
\ No newline at end of file
<?php
//データベースへ接続
$db = sqlite_open("schedule.sqlite", 0666, $err);
//SQL命令の発行
$rs = sqlite_query("SELECT * FROM schedule ORDER BY s_date, s_time" ,$db);
?>
<html>
<head>
<title>簡易スケジュール帳</title>
</head>
<body>
<h1 style = "background:#cccccc">簡易スケジュール帳</h1>
<table border = "1">
<tr>
<th>日付</th><th>時刻</th><th>予定名</th><th>備考</th><th>削除</th>
</tr>
//取得した結果セットを出力
<?php while ($row = sqlite_fetch_array($rs)){ ?>
<tr>
<td><?php print($row['s_date']); ?></td>
<td><?php print($row['s_time']); ?></td>
<td><?php print($row['title']); ?></td>
<td><?php print($row['memo']); ?></td>
<td>
<input type = "button" value = "削除" onclick="location.href = 'schedule_dalete.php?sid =<?php print($row['sid']); ?>'" /></td>
</tr>
<?php
}
?>
<!-- データベースの切断 -->
sqlite_close($db);
?>
</table>
</body>
</html>
<?php
function showopt($start, $end)
{
for($i = $start; $i <= $end; $i++) {
print("<option valur = '".$i."'>".$i."</option>");
}
}
?>
<html>
<head>
<title>簡易スケジュール帳</title>
</head>
<body>
<h1 style = "background:#cccccc">簡易スケジュール帳</h1>
<form method = "POST action = "schedule_record2.php">
<table>
<tr>
<th align = "right">予定名:</th>
<td><input type = "text" name = "title" size = "50" maxlength = "255" /></td>
</tr>
<tr>
<th align = "right">日付:</th>
<td>
<select = name = "s_date_year"><?php showOpt(2005,2010);?></select>年
<select = name = "s_date_month"><?php showOpt(1,12);?></select>月
<select = name = "s_date_day"><?php showOpt(1,31);?></select>日
</td>
</tr>
<th align = "right">開始時間:</th>
<td>
<select name = "s_time_hour"><?php showOpt(0,23); ?></select>時
<select name = "s_time_minute"><?php showOpt(0,59); ?></select>分
</td>
</tr>
<tr>
<th align = "right">備考:</th>
<td><input type ="text" name = "memo" size = "70" maxlengh="255" /></td>
</tr>
<tr>
<td rowspan = "2">
<input type - "submit" value = "登録" />
<input type = "reset" value = "クリア" />
</td>
</tr>
</table>
</form>
</body>
</html>
\ No newline at end of file
<?php
$db = sqliyr_open("schedule.sqlite", 0666, $err);
$s_date = $_POST['s_date_year']."/".$_POST['s_date_month']."/".$_POST['s_date_day'];
$s_time = $_POST['s_time_hour'].":".$_POST['s_minute'];
splite_query($db, "INSERT INTO schedule(title, s_date, s_time, memo) VALUES('".sqite_escape_string($s_date)."','".sqlite_escape_string($s_time)."','".sqlite_escape_string($_POST['memo'])."')");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment