Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
1
10php
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yu Kimiduka
10php
Commits
dfde8e78
Commit
dfde8e78
authored
Jul 14, 2016
by
君塚 悠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
プログラム作製(schedule_delete.php,schedule_read.php,schedule_record.php,schedule_record2.php:データベース)
parent
5e975caf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
0 deletions
+102
-0
schedule_delete.php
php/php10/day08_9/schedule_delete.php
+12
-0
schedule_read.php
php/php10/day08_9/schedule_read.php
+37
-0
schedule_record.php
php/php10/day08_9/schedule_record.php
+48
-0
schedule_record2.php
php/php10/day08_9/schedule_record2.php
+5
-0
No files found.
php/php10/day08_9/schedule_delete.php
0 → 100644
View file @
dfde8e78
<?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/php10/day08_9/schedule_read.php
0 → 100644
View file @
dfde8e78
<?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/php10/day08_9/schedule_record.php
0 → 100644
View file @
dfde8e78
<?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/php10/day08_9/schedule_record2.php
0 → 100644
View file @
dfde8e78
<?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'
])
.
"')"
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment