Dan*_*iel 4 php sql doctrine symfony1 symfony-1.4
我有以下代码:
$getmoney = Doctrine::getTable('Countries')->find(1);
$insertmoney = new Accounts();
$insertmoney->userid = $userid;
$insertmoney[$getmoney->getCurrency()] = $getmoney->getBaby();
$insertmoney->save();
Run Code Online (Sandbox Code Playgroud)
并且Doctrine生成的查询是:
INSERT INTO accounts (1, userid, 2) VALUES ('0', '31', '15')
Run Code Online (Sandbox Code Playgroud)
但它似乎有一个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')
Run Code Online (Sandbox Code Playgroud)
可能错误的是列数字的不幸名称.我只是因为它使事情用数字很多容易.
如何生成在" ` " 之间具有列名称的查询?