I am having trouble just trying to pull data out of my table. I just want to pull the integer value from column Diff and add/subtract numbers to it.
Once I am done adding/subtracting, I want to update each row with the new value"
My Table chart for "users" in ruby
This is my code as of now
require 'date'
require 'mysql2'
require 'time'
def test()
connect = Mysql2::Client.new(:host => "localhost", :username => "root", :database => "rubydb")
result = connect.query("SELECT * FROM users where Status='CheckOut'")
if result.count > 0
result.each do |row|
stored_diff = connect.query("SELECT * FROM users WHERE Diff")
#stored_diff = stored_diff.to_s
puts stored_diff
end
end
end
test()
I am sure the code in the hashtag does not work since I am getting like #Mysql2::Result:0x000000000004863248 etc. Can anyone help me with this?
