【问题标题】:DDBB structure so I can Manage playlists - Current, previous, nextDDBB 结构,因此我可以管理播放列表 - 当前、上一个、下一个
【发布时间】:2011-03-17 02:17:11
【问题描述】:

现在我有:

Table playlist (id, name, id_user,many_items,last_item_used,...)

table playlist_map (id, id_user, id_item,position...)

我想知道,这是否足以让我让用户从播放列表中添加/删除项目,并从播放列表中加载上一个和下一个项目?

或者我应该改变我的计划? (我已经完成了 50% 的 PHP,仍然没有问题,但我有这种感觉..)

提前致谢:P

我已经完成了播放列表的插入/编辑/删除,现在我准备好了:

class playlist_item{

    protected $id;
    protected $id_item;
    protected $nombre;
    protected $url;
    protected $id_playlist;
    protected $position;


     function __construct($id) {



    }

    function get_what($what){
        if($what == 'next'){

        }else if($what == 'prev'){

        }else if($what == 'last'){

        }else if($what == 'first'){

        }else if($what == 'current'){

        }

    }




}

【问题讨论】:

  • 通过写这个.... ehm.. 在 playlist_map 中排序,对吗??

标签: php mysql sql database-design database-schema


【解决方案1】:

我想您有一个班级播放列表,您在其中进行了插入/编辑/删除。那么,为什么要在 playlist_item 类中编写 get_what 方法。将它放在您的班级播放列表中会更合适吗? (因为,我还假设您的意图是 get_what 方法返回一个 playlist_item 对象实例)。

【讨论】:

  • 实际上我的目的是获取播放列表中的位置和对象的 id。已经解决了这个问题。但我不记得我是否按照问题做了,我会检查;)
  • 我也觉得这个答案应该是个评论;它实际上并没有回答:)
猜你喜欢
  • 2011-05-21
  • 2019-03-05
  • 2012-11-02
  • 1970-01-01
  • 1970-01-01
  • 2020-02-27
  • 1970-01-01
  • 1970-01-01
  • 2011-07-07
相关资源
最近更新 更多