i was able to fetch the value of total but when i tried to add it to to price so as to get value of sum in this line
of code
Expand|Select|Wrap|Line Numbers
- sum = price + %s, row[0]
- puts "sum"
Expand|Select|Wrap|Line Numbers
- #!/Ruby19/bin/ruby
- require 'cgi'
- cgi = CGI.new
- puts cgi.header
- require "dbi"
- price = '100'
- begin
- # connect to the MySQL server
- conn = DBI.connect("DBI:Mysql:db:localhost",
- "root", "root566")
- rs = con.query("SELECT total from product where product_id = '20'")
- row = stmt.fetch do
- end
- puts "<font color=green size=4><b>get total values</b></font><br><br>"
- printf '<b>total:</b> %s<br>', row[0]
- sum = price + %s, row[0]
- puts "sum"
- rescue Mysql::Error => e
- puts e.errno
- puts e.error
- ensure
- con.close if con
- end