From: ben baka Date: 2008-07-02T20:21:25+09:00 Subject: Re: Ruby MySQL INSERT variable ------=_Part_5948_10544397.1214997865369 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Well, i solved this by bringing ( ' ' ) around the #{k}. Thus your code is likely to become like this, my = Mysql::new("localhost", "root", "pass", "table") my.query("INSERT INTO table VALUES('2008-05', '#{k}', 324)") Hope it solves it. On 7/1/08, Justin To wrote: > > k = "50" > > my = Mysql::new("localhost", "root", "pass", "table") > my.query("INSERT INTO table VALUES('2008-05', #{k}, 324)") > > ./Class.rb:212:in `query': Unknown column '50' in 'field list' > (Mysql::Error) > > How do I insert a variable into a row? > > Thanks > -- > Posted via http://www.ruby-forum.com/. > > -- --Ben Baka Blog : http://benjaminbaka.wordpress.com/ ------=_Part_5948_10544397.1214997865369--