DDBB结构,所以我可以管理播放列表 - 当前,上一个,下一个

时间:2011-03-17 02:17:12

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

现在我有:

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'){

        }

    }




}

1 个答案:

答案 0 :(得分:1)

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