Kohana ORM和文件上传问题...在没有图像时将记录徽标设置为等于记录徽标
这会导致此错误...
操作数应包含 1 列 [ UPDATE
record
SETlogo
= ('', '', '', 4, 0) WHEREid
= '0']
if ($_FILES['logo']['name'] == '') {
$record->logo = $record->logo;
}
else{
// INSERTION WORKS FINE
}
我也在使用 Formo 模块,如果这有影响的话...
有没有办法直接踢出完全将徽标从插入脚本中删除等等...因为 $record->logo = $record->logo
会导致失败?
This causes this error...
Operand should contain 1 column(s) [ UPDATE
record
SETlogo
= ('',
'', '', 4, 0) WHEREid
= '0' ]
if ($_FILES['logo']['name'] == '') {
$record->logo = $record->logo;
}
else{
// INSERTION WORKS FINE
}
I'm also using the Formo module if that makes a difference...
Is there a way to just kick-out the logo out of the insertion script altogether or such... since $record->logo = $record->logo
causes a fail?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果未设置 $record->logo 将导致错误。您至少必须说:
但最好的办法是使用
Validation::factory($_FILES)->check()
这只是我上次管理此内容时的一个片段:
Would cause an error if $record->logo is not set.. You would have to atleast say:
but the best thing to do would be to use
Validation::factory($_FILES)->check()
This is just a snippet from when i last managed this: