diff --git "a/mycgi/\043gomi.rb\043" "b/mycgi/\043gomi.rb\043"
deleted file mode 100755
index 2598b6a..0000000
--- "a/mycgi/\043gomi.rb\043"
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env ruby
-# coding: utf-8
-Encoding.default_external = 'utf-8' # UTF-8のCSVファイルを読むため
-require 'cgi'
-require 'sqlite3'
-c = CGI.new(:accept_charset => "UTF-8")
-
-trash = c["gomi"]
-array = []
-#データベース読み取り処理は全く同じ
-db = SQLite3::Database.new("gomi.db")
-db.results_as_hash = true
-result = db.execute("SELECT * FROM gomi where name LIKE '%#{trash}%';")
-
-print("Content-type: text/html; charset=utf-8
-
-
-
検索結果
-
-")
-result.select!{|row|
-printf("
品名 : 「%s」
ごみ区分 : 「%s」
備考 : %s
-------------------------------------------------------------------------------",row["name"], row["type"], row["remark"])}
-puts("
-
-")
-
-# keep1 = result.join(",")
-# array = keep1.split(",")
-
-# array.each do |row|
-# keep = row.join(",")
-# end
-# printf("keep1:%s
",keep1[0])
-# printf("array:%s
",array[0])
-# result.each{ |row|
-# printf("%s
%s
%s
",row["name"],row["type"],row["remark"])}
-# printf("
品名 : 「%s」
ごみ区分 : 「%s」
備考 : %s
-------------------------------------------------------------------------------",
-# array[0], array[1], array[2])
-# printf("品名 : 「%s」
分別区分 : 「%s」
備考 : 「%s」",array[0],array[1],array[2])
diff --git "a/mycgi/\043rensyu5.rb\043" "b/mycgi/\043rensyu5.rb\043"
deleted file mode 100644
index 8920071..0000000
--- "a/mycgi/\043rensyu5.rb\043"
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env ruby
-# coding: utf-8
-Encoding.default_external = 'utf-8' # UTF-8のCSVファイルを読むため
-require 'sqlite3'
-
-keep = ""
-#データベース読み取り処理は全く同じ
-db = SQLite3::Database.new("gomi.db")
-db.results_as_hash = true
-# result = db.execute("SELECT * FROM gomi where name LIKE '%ロープ%';")
-
-result = db.execute("SELECT * FROM gomi where name LIKE '%ペット%';")
- # keep = rs.join(",")
- # keep = keep.split(",")
- puts result
-
-
-# keep = array.join(",")
-# p keep[0]
-# keep1 = keep.split(",")
-# p keep1[0]
-# array.each { |row|
-# p array[0]}
-
-# # printf("%s %s %s",rs[0],rs[1],rs[2])
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # p result[0]
- # p result
-
-# array = []
-# keep = ""
-
-# result.each do |row|
-# keep = row.join(",")
-# array = keep.split(",")
-
-# end
-
-# puts result[0]
-# db.each{|row|
-
diff --git "a/mycgi/\043test1.rb\043" "b/mycgi/\043test1.rb\043"
new file mode 100755
index 0000000..0f38ed9
--- /dev/null
+++ "b/mycgi/\043test1.rb\043"
@@ -0,0 +1,51 @@
+#!/usr/bin/env ruby
+# coding: utf-8
+Encoding.default_external = 'utf-8' # UTF-8のCSVファイルを読むため
+require 'cgi'
+require 'csv'
+c = CGI.new(:accept_charset => "UTF-8")
+
+#データベース読み取り処理は全く同じ
+csv = CSV.read("cgomi.csv", {:headers => true}) # csvファイルを読んでcsv変数に格納
+db = csv # あとで全データを使う場合にそなえcsv変数は温存
+
+# 検索パターンはHTMLフォームへの入力値を取得する
+# id = c["num"]
+ trash = c["gomi"]
+# syori = c["bunbetu"]
+# method = c["houhou"]
+
+# if id > ""
+# ptn = Regexp.new(id)
+# db = db.select {|row| ptn =~ row["番号"]}
+# end
+
+if trash > ""
+ ptn = Regexp.new(trash)
+ db = db.select {|row|
+ ptn =~ row["品名"]}
+end
+
+# if syori > ""
+# ptn = Regexp.new(syori)
+# db = db.select {|row| ptn =~ row["ごみ区分"]}
+# end
+# if method > ""
+# ptn = Regexp.new(method)
+# db = db.select {|row| ptn =~ row["備考"]}
+# end
+
+print("Content-type: text/html; charset=utf-8
+
+
+
+検索結果
+
+
+")
+db.each {|row|
+ printf("
ID : 「%s」
品名 : 「%s」
ごみ区分 : 「%s」
備考 : %s
-------------------------------------------------------------------------------",row["ID"],row["品名"], row["ごみ区分"],row["備考"])}
+puts("
+
+")
+
diff --git "a/mycgi/.\043gomi.rb" "b/mycgi/.\043gomi.rb"
deleted file mode 120000
index 9e1d366..0000000
--- "a/mycgi/.\043gomi.rb"
+++ /dev/null
@@ -1 +0,0 @@
-c119104@joy.e.koeki-u.ac.jp.22152
\ No newline at end of file
diff --git "a/mycgi/.\043rensyu5.rb" "b/mycgi/.\043rensyu5.rb"
deleted file mode 120000
index ed84904..0000000
--- "a/mycgi/.\043rensyu5.rb"
+++ /dev/null
@@ -1 +0,0 @@
-c119104@joy.e.koeki-u.ac.jp.2119
\ No newline at end of file
diff --git "a/mycgi/.\043test1.rb" "b/mycgi/.\043test1.rb"
new file mode 120000
index 0000000..2f4fbc6
--- /dev/null
+++ "b/mycgi/.\043test1.rb"
@@ -0,0 +1 @@
+c119104@joy.e.koeki-u.ac.jp.23537
\ No newline at end of file
diff --git a/mycgi/fi.rb b/mycgi/fi.rb
new file mode 100755
index 0000000..5cd66c8
--- /dev/null
+++ b/mycgi/fi.rb
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# coding: utf-8
+Encoding.default_external = 'utf-8' # UTF-8のCSVファイルを読むため
+require 'cgi'
+require 'sqlite3'
+c = CGI.new(:accept_charset => "UTF-8")
+
+trash = c["gomi"]
+#データベース読み取り処理は全く同じ
+db = SQLite3::Database.new("gomi.db")
+db.results_as_hash = true
+result = db.execute("SELECT * FROM gomi where name LIKE '%#{trash}%';")
+
+print("Content-type: text/html; charset=utf-8
+
+
+
+検索結果
+
+
+")
+result.select!{|row|
+printf("
品名 : 「%s」
ごみ区分 : 「%s」
備考 : %s
-------------------------------------------------------------------------------",row["name"], row["type"], row["remark"])}
+puts("
+
+")
+
diff --git a/mycgi/gomi.rb b/mycgi/gomi.rb
index ed27fcb..c4cd0d9 100755
--- a/mycgi/gomi.rb
+++ b/mycgi/gomi.rb
@@ -6,38 +6,21 @@
c = CGI.new(:accept_charset => "UTF-8")
trash = c["gomi"]
-array = []
#データベース読み取り処理は全く同じ
db = SQLite3::Database.new("gomi.db")
db.results_as_hash = true
result = db.execute("SELECT * FROM gomi where name LIKE '%#{trash}%';")
-# keep = ""
-# result.each do |row|
-# keep = row.join(",")
-# array.push(keep.split(","))
-# end
print("Content-type: text/html; charset=utf-8
+
検索結果
-")
-printf("
品名 : 「%s」
ごみ区分 : 「%s」
備考 : %s
-------------------------------------------------------------------------------",row["name"], row["type"], row["remark"])
+
+")
+result.select!{|row|
+printf("
品名 : 「%s」
ごみ区分 : 「%s」
備考 : %s
-------------------------------------------------------------------------------",row["name"], row["type"], row["remark"])}
puts("
")
-
-# keep1 = result.join(",")
-# array = keep1.split(",")
-
-# array.each do |row|
-# keep = row.join(",")
-# end
-# printf("keep1:%s
",keep1[0])
-# printf("array:%s
",array[0])
-# result.each{ |row|
-# printf("%s
%s
%s
",row["name"],row["type"],row["remark"])}
-# printf("
品名 : 「%s」
ごみ区分 : 「%s」
備考 : %s
-------------------------------------------------------------------------------",
-# array[0], array[1], array[2])
-# printf("品名 : 「%s」
分別区分 : 「%s」
備考 : 「%s」",array[0],array[1],array[2])
diff --git a/mycgi/rensyu5.rb b/mycgi/rensyu5.rb
index c5dee3f..b674bbc 100644
--- a/mycgi/rensyu5.rb
+++ b/mycgi/rensyu5.rb
@@ -9,11 +9,13 @@
db.results_as_hash = true
# result = db.execute("SELECT * FROM gomi where name LIKE '%ロープ%';")
-db.execute("SELECT * FROM gomi where name LIKE '%ペット%';").each do |rs|
+result = db.execute("SELECT * FROM gomi where name LIKE '%ペット%';")
# keep = rs.join(",")
- # keep = keep.split(",")
- puts rs
-end
+# keep = keep.split(",")
+result.select!{|row|
+printf("%s %s %s\n",row["name"],row["type"],row["remark"])}
+
+
# keep = array.join(",")
# p keep[0]
diff --git a/mycgi/test1.rb b/mycgi/test1.rb
index 1d02945..b89d581 100755
--- a/mycgi/test1.rb
+++ b/mycgi/test1.rb
@@ -43,11 +43,9 @@
")
- db.each {|row|
-puts row}
-# puts row
-# db.each {|row|
-# printf("
ID : 「%s」
品名 : 「%s」
ごみ区分 : 「%s」
備考 : %s
-------------------------------------------------------------------------------",row["ID"],row["品名"], row["ごみ区分"],row["備考"])}
+
+db.each {|row|
+ printf("
ID : 「%s」
品名 : 「%s」
ごみ区分 : 「%s」
備考 : %s
-------------------------------------------------------------------------------",row["ID"],row["品名"], row["ごみ区分"],row["備考"])}
puts("