-
-
Save anonymous/b8660dd61ce3152bd8ae to your computer and use it in GitHub Desktop.
trying to get content in the html output. not just the number of loops.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require "cgi" | |
require "mysql" | |
#DB Config | |
DB_Host = "127.0.0.1" | |
DB_User = "root" | |
DB_Pass = "pass" | |
DB_Table = "ruby" | |
Day_Of_Week = Time.now.strftime("%A") | |
con = Mysql.new(DB_Host, DB_User, DB_Pass, DB_Table) | |
cgi = CGI.new('html4') | |
rs = con.query("SELECT * FROM specials WHERE day='#{Day_Of_Week}'") | |
n_rows = rs.num_rows | |
cgi.out{ | |
CGI.pretty( | |
cgi.html{ | |
cgi.head{ "\n"+cgi.title{"This Is a Test"} } + | |
cgi.body{ "\n"+ | |
cgi.table{ | |
n_rows.times do | |
mah_string = '' | |
mah_string += rs.fetch_row.join("\s ") | |
puts mah_string# too much here. s | |
end | |
} | |
} | |
} | |
) | |
} | |
---------------yeilds this output-------------------- | |
76 Mura Saturday Special not updated | |
77 Sparians Saturday Special not updated | |
78 The Oxford Saturday $4 Vodka Drinks $5 Fireball $6 Vodka Red Bull | |
79 Sono Saturday Special not updated | |
80 Isaac Hunter Saturday Special not updated | |
81 Cameron Bar and Grill Saturday Special not updated | |
82 Taste Saturday Special not updated | |
83 Hibernian Saturday Special not updated | |
84 Backyard Bistro Saturday $2 Bud, Bud Light, Bud Light Lime, and Platinum Bottles, $3 Jose Cuervo, | |
85 East Village Saturday $3 Coronas$3 Pints of NC Craft Beers$5 Flavored Mojitos$5 Vodka Bombs(Any F | |
86 Capital Club Saturday Special not updated | |
87 Rukus Raleigh Saturday Special not updated | |
88 The Pickled Onion Saturday Bud Light Drafts$2.50Harpoon SeasonalDrafts$3.50Bell`s TwoHearted Draf | |
89 Nappertandys Saturday $2.25 Natural Light Bottles$5 Crown, Crown Maple, Crown Blackbr /> | |
90 Saints and Scholars Saturday | |
Content-Type: text/html | |
Content-Length: 234 | |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<HTML> | |
<HEAD> | |
<TITLE> | |
This Is a Test | |
</TITLE> | |
</HEAD> | |
<BODY> | |
<TABLE> | |
15 | |
</TABLE> | |
</BODY> | |
</HTML> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment