A
Arun Kumar
Hi,
I'm new to rubi and at present i'm trying to write a sample code for
html extraction and store it in the database. The following is the code
for that :
doc = Hpricot(open("http://www.google.com/"))
(doc/"a").each do |link|
if (link.attributes['class'] == 'gb1')
href = link.inner_text.strip
con = DBI.connect("DBI:Mysql:Sample:localhost", "arunkumar",
"123456")
stat = con.prepare("Insert into hello values ('', ?, 'GK', 71,
'female')")
stat.execute("#{href}")
stat.finish
con.commit
puts "Records have been inserted"
else
puts "Sorry! No matches found."
end
end
When i execute it all works well except a warning saying :
/usr/lib/ruby/gems/1.8/gems/hpricot-0.6.164/lib/hpricot/builder.rb:26:
warning: `&' interpreted as argument prefix
I dont know where went wrong for such a warning to get displayed. Please
help.
Regards
Arun Kumar
I'm new to rubi and at present i'm trying to write a sample code for
html extraction and store it in the database. The following is the code
for that :
doc = Hpricot(open("http://www.google.com/"))
(doc/"a").each do |link|
if (link.attributes['class'] == 'gb1')
href = link.inner_text.strip
con = DBI.connect("DBI:Mysql:Sample:localhost", "arunkumar",
"123456")
stat = con.prepare("Insert into hello values ('', ?, 'GK', 71,
'female')")
stat.execute("#{href}")
stat.finish
con.commit
puts "Records have been inserted"
else
puts "Sorry! No matches found."
end
end
When i execute it all works well except a warning saying :
/usr/lib/ruby/gems/1.8/gems/hpricot-0.6.164/lib/hpricot/builder.rb:26:
warning: `&' interpreted as argument prefix
I dont know where went wrong for such a warning to get displayed. Please
help.
Regards
Arun Kumar