Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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
- }
- }
- )
- }
- -------------------yields this------------------
- 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, $5 Patron, Avion and Tres Gen
- 85 East Village Saturday $3 Coronas$3 Pints of NC Craft Beers$5 Flavored Mojitos$5 Vodka Bombs(Any Flavor)$3 Glasses of White Zinf
- 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 Drafts$3.50Sangria$4.00Royal Flush
- 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: 202
- <!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>
- 15
- </BODY>
- </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement