开发者

ruby inserts null values to mysql table

开发者 https://www.devze.com 2023-04-02 13:20 出处:网络
I am using the MySQL gem in order to write values to a MySQL table. The table has 2 fields:one is int and the other is text. However, when I开发者_如何学运维 write data (using Ruby MySQL gem) into the

I am using the MySQL gem in order to write values to a MySQL table. The table has 2 fields: one is int and the other is text. However, when I开发者_如何学运维 write data (using Ruby MySQL gem) into the table, the text shows up as NULL. Any ideas?

My ruby code:

insert_new = db.prepare "INSERT INTO keywords (id, name) VALUES (?,?)"
insert_new.execute i, element.text.to_s
0

精彩评论

暂无评论...
验证码 换一张
取 消