if things are okay. but don't know how to proceed
below is the code
#!C:/Ruby192/bin/ruby
require 'cgi'
cgi = CGI.new
puts cgi.header
require "mysql"
begin
con = Mysql.new 'localhost', 'root', 'mak44', 'testdb'
rs = con.query("SELECT * FROM records")
rs.each do |row|
#print value of price in records table
puts row[0]
end
if row[0] == '100'
puts 'yes'
else
puts 'Hello '
end
rescue Mysql::Error => e
puts e.errno
puts e.error
ensure
con.close if con
end
the code prints the value of price but does not print yes from the if statement if the value of price from database is 100


Sign In
Create Account


Back to top









