【问题标题】:grocery crud get relation table fields杂货杂货获取关系表字段
【发布时间】:2014-12-31 13:14:21
【问题描述】:

我对杂货店 CRUD 和“set_relation_n_n”函数有疑问: http://www.grocerycrud.com/documentation/options_functions/set_relation_n_n

我想要“此表”、“关系表”和“选择表”中的字段。有没有办法做到这一点?这是我的架构(MySQL):

已编辑:

一些事情(目前):

这个表:timeline_events;

关系表:timeline_events_options;

选择表:timeline_events_tags;

id_timeline 是另一个表的外键(上图中未显示),event_id 是我现在使用的小部件所需的字段。 id_event 是来自timeline_events 的外键,id_event_tags 是来自timeline_events_tags 的外键。

非常感谢您的回答:)。

【问题讨论】:

    标签: codeigniter codeigniter-2 grocery-crud


    【解决方案1】:

    我认为你应该先修理你的桌子。这三个表都有名为 id 的主键,在timeline_events 表中可以是id_timelineid_eventtimeline_events_options 表中和id_tagtimeline_events_tags 表中。将其视为您的表格字段,这应该是函数。

    $crud->set_relation_n_n('eventtags', 'timeline_events_options', 'timeline_events_tags', 'id_timeline', 'id_tag', 'tags','priority');
    

    我不保证它会起作用,因为我没有测试它,但你可以试试这个。

    【讨论】:

    • 不,没有用(数据库错误)。我编辑了我的帖子以进行一些澄清:)。非常感谢您的回答。
    猜你喜欢
    • 2013-10-24
    • 1970-01-01
    • 2013-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多