dpsr1670 2016-05-26 06:51
浏览 30
已采纳

PHP,laravel,为什么这个查询在ubuntu上失败了?

This works on WAMP just fine:

$db = $instance->Databases->where('db_default', 1)->first();

It assings perfectly the value of the model im looking for, but it doesnt work on Ubuntu and I have no idea why, after hours of trying and trying, I did this:

$db = $instance->Databases->where('db_default', '1')->first();

And it worked correctly, is there something wrong with my Ubuntu 14 install or this is standard behavior? In the laravel docs the query without quotes so I know its possible.

Just in case the db_default field on my database its of type tinyint.

  • 写回答

1条回答 默认 最新

  • douxu2081 2016-05-26 07:24
    关注

    My problem was that I was using Databases without (), the correct way is:

    $db = $instance->Databases()->where('db_default', 1)->first();
    

    My biggest problem was that first I wasnt getting any error (only an empty result on Ubuntu) and that it sure is working on WAMP.

    Ill leave this open in case someone can shed light into this issue.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码