Sql select : Mysql « Database « Ruby






Sql select


require 'mysql'

m = Mysql.new("localhost","ruby","secret","maillist")
r = m.query("SELECT * FROM people ORDER BY name")
r.each_hash do |f|
  print "#{f['name']} - #{f['email']}"
end

 








Related examples in the same category