Mysql result is showing empty

Hi
Bellow script.,
when i run the script. it does not show any output .

#!/usr/bin/ruby
require 'cgi'
require 'mysql'
cgi = CGI.new

m = Mysql.new("localhost","root","","fosiul")
r = m.query("SELECT * FROM dc")

puts cgi.header

puts "<html><body>

        <select>
                r.each_hash do |f|
                        <option> #{f['dc']}</option>
                end
                </select>
      </body></html>"

where i am doing wrong ???
Please let me know
Thanks

···

--
Posted via http://www.ruby-forum.com/.

Does this work?

...
puts "<html><body><select>"
r.each_hash do |f|
     puts "<option>#{f['dc']}</option>"
end
puts "</select></body></html>"
...

Sam

···

On 10/02/2012 09:56 AM, Ferdous ara wrote:

Hi
Bellow script.,
when i run the script. it does not show any output .

#!/usr/bin/ruby
require 'cgi'
require 'mysql'
cgi = CGI.new

m = Mysql.new("localhost","root","","fosiul")
r = m.query("SELECT * FROM dc")

puts cgi.header

puts "<html><body>

         <select>
                 r.each_hash do |f|
                         <option> #{f['dc']}</option>
                 end
                 </select>
       </body></html>"

where i am doing wrong ???
Please let me know
Thanks

Hi just a quick question

if i want to add an external css file with this script
how will i add that ??
whats the procedure ??

Thanks

···

--
Posted via http://www.ruby-forum.com/.

S

...
puts "<html><body><select>"
r.each_hash do |f|
     puts "<option>#{f['dc']}</option>"
end
puts "</select></body></html>"
...

Sam

Hi thanks

its works, So i was missing puts

···

--
Posted via http://www.ruby-forum.com/.