From: "Bartosz DziewoƄski" Date: 2012-08-10T00:22:21+09:00 Subject: Re: Help with database-related code pls 2012/8/9 Kaye Ng : > I understand why it's in the form of a hash (because of > $db.results_as_hash = true). What I don't understand is why the > repeated values? Take note of the number of elements, I was expecting 5 > only (id, name, job, gender, and age), but it has 10 because the values > (with 0,1,2,3,4 keys) were repeated. That's just how some database adapters work, so you can access the results both by columns name (person['name']) and by its number (person[1]). > Another thing I don't understand is that when I remove the ".first", run > the program, enter a valid id or name, or just about anything really, it > results in: Because .execute returns an array of hashes (even if this array only has one item). .first the chooses only the first one of them. -- Matma Rex