I have the following code:
$getmoney = Doctrine::getTable('Countries')->find(1);
$insertmoney = new Accounts();
$insertmoney->userid = $userid;
$insertmoney[$getmoney->getCurrency()] = $getmoney->getBaby();
$insertmoney->save();
Doctrine生成的查询语句是:
INSERT INTO accounts (1, userid, 2) VALUES ('0', '31', '15')
但是看起来出现了SQL错误:
1064您的SQL语法有误;请检查与您的MySQL服务器版本对应的手册,以获取正确的语法使用方式,附近为'1、userid、2)VALUES('0'、'31'、'15')'
正确的查询应该是:INSERT INTO accounts (`1`, `userid`, `2`) VALUES ('0', '31', '15')
可能这里的问题在于不幸的列名,是数字。我只能使用数字,因为它使事情变得简单得多。
我应该怎么做才能生成一个查询,其中列名在`之间?