syntax errors

Hi --

I'm sure this is going to be a very silly question but can anyone tell me why this code is giving me errors?

require 'rubygems' require 'mysql' db = Mysql.new('localhost', 'root', 'avuzritfanu', 'studentevents') begin results = db.query "SELECT * FROM events_event" puts "Number of users #{results.num_rows}"

results.each_hash do |row|

I'm re-ordering your lines, to take the row assignments out of the literal hash:

   row["start_time"] = "09:00:00" if row["start_time"].nil?    row["end_time"] = "17:00:00" if row["end_time"].nil?    event = { :title=>row["title"],    :startTime=>row["start_time"],    :endTime=>row["end_time"]}    puts "Title of event #{row["start_time"]} "

Are you sure you don't mean row["title"] there? Also, why are you creating the event hash at all? You don't seem to use it.

end

David

Hi David

It's just a snippet of the entire code, the events hash will eventually be used to populate a google calendar.

Hopefully

:slight_smile: