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
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/tech/database/6661.html
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
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/tech/database/6661.html