我有以下代码:
$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 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1, userid, 2) VALUES ('0', '31', '15')' at line 1
相关性查询将是:
INSERT INTO accounts (`1`, `userid`, `2`) VALUES ('0', '31', '15')
这可能是错误的是列数字的不幸名称。我不得不使用数字,因为它使很多更容易。
如何生成“`”之间列名称的查询?