Reputation: 1
I was getting
syntax error, unexpected keyword_end, expecting end-of-input
in Command Prompt when trying to install and test ruby.
require 'mysql2'
client = Mysql2::Client.new(host: 'localhost', username: 'root', password: 'password1')
sql = 'select now() as timestamp'
result = client.query(sql)
puts row['time stamp']
end
Upvotes: 0
Views: 613
Reputation: 368944
The code is missing do
.
client = Mysql2::Client.new(host: 'localhost', username: 'root', password: 'password1')
sql = 'select now() as timestamp'
result = client.query(sql) do # <----
puts row['timestamp']
end
FYI, time stamp
should be timestamp
. (This is not direct cause of the syntax error).
Upvotes: 1