monica23 0 Newbie Poster

Good day everyone, i need to print error message if id or row[0] is greater than 1
and a welcome message if name is correct and error message if the name is not correct. what my code does is that it prints out error message if id or row[0] is greater than 1 and a welcome message if name is correct. but if wrong name is entered instead of printing error message "you are not mutago" , it will display empty page. I don't know whether the problem is from end statement.any help

/Ruby/bin/ruby 


require "mysql"

begin
    con = Mysql.new 'localhost', 'muta', 'muta666', 'db'

   rs = con.prepare("SELECT id,name FROM account where name=?")
    con.execute('mutago')
  rs.fetch do |row|
  # id represents row[0] and name = row[1]

if row[0] >'1'

puts 'your id is greater than 1'
#working

elsif row[1] == 'mutago'
end
puts 'welcome mutago'
#working
else 
puts "you are not mutago"
#not working here is the problem
end

end
rescue Mysql::Error => e
    puts e.errno
    puts e.error

ensure
 con.close if con

end
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.