ruby连接mysql代码

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

编程技巧