A
abc-
Hi,
after hours of reading and searching i can't get the solution
code:
require 'mysql'
my = Mysql.new("localhost", "user", "", "database")
data = my.query("select * from books Limit 5")
p "first time"
data.each { |d| p d[0]}
p "again"
data.each { |d| p d[0]}
Result:
"first time"
"7"
"9"
"11"
"12"
"14"
"again"
I expected that the result would be:
"first time"
"7"
"9"
"11"
"12"
"14"
"again"
"7"
"9"
"11"
"12"
"14"
I get this result only if i add
require 'mysql'
my = Mysql.new("localhost", "user", "", "database")
data = my.query("select * from books Limit 5")
p "first time"
data.each { |d| p d[0]}
p "again"
data = my.query("select * from books Limit 5") << ADDED
data.each { |d| p d[0]}
So i think thats not the rigth way - don't repeat yourself
Thanks in advance
DG
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
after hours of reading and searching i can't get the solution
code:
require 'mysql'
my = Mysql.new("localhost", "user", "", "database")
data = my.query("select * from books Limit 5")
p "first time"
data.each { |d| p d[0]}
p "again"
data.each { |d| p d[0]}
Result:
"first time"
"7"
"9"
"11"
"12"
"14"
"again"
I expected that the result would be:
"first time"
"7"
"9"
"11"
"12"
"14"
"again"
"7"
"9"
"11"
"12"
"14"
I get this result only if i add
require 'mysql'
my = Mysql.new("localhost", "user", "", "database")
data = my.query("select * from books Limit 5")
p "first time"
data.each { |d| p d[0]}
p "again"
data = my.query("select * from books Limit 5") << ADDED
data.each { |d| p d[0]}
So i think thats not the rigth way - don't repeat yourself
Thanks in advance
DG
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-