MovieLib - Your movie database on web
It is still not perfect. When you switch to tvshows you see all genres, studios etc.on left panel from both (movies and tvshows).

I speparated actor table. Try this function:
Code:
function panels_array($columns, $table) {
    
    $sep_tab = array('genre', 'country', 'studio', 'director');
    $panels_array = array();
    foreach ($columns as $val) {
        if (in_array($val, $sep_tab)) {
            $sel = 'SELECT DISTINCT ' . $val . '.id, ' . $val . '.' . $val . ' FROM `' . $val . '`, `' . $table . '_' . $val . '` WHERE ' . $val . '.id=' . $table . '_' . $val . '.' . $val . 'id ORDER BY ' . $val . '.' . $val;
            $res = mysql_q($sel);
            while ($r = mysqli_fetch_assoc($res)) {
                $panels_array[$val][$r['id']] = $r[$val];
            }
        } else if ($val == "actor") {
            $sel = 'SELECT ' . $val . '.id, ' . $val . '.' . $val . ' FROM `' . $val . '` ORDER BY ' . $val . '.' . $val;
            $res = mysql_q($sel);
            while ($r = mysqli_fetch_assoc($res)) {
                $panels_array[$val][$r['id']] = $r[$val];
            }
        } else {
            $sel = 'SELECT DISTINCT `' . $val . '` FROM `' . $table . '` WHERE `hide` = 0 ORDER BY `' . $val . '`';
            $res = mysql_q($sel);
            if (mysqli_num_rows($res) > 0) {
                while ($r = mysqli_fetch_assoc($res)) {
                    if ($r[$val] != '') {
                        $panels_array[$val][] = $r[$val];
                    }
                }
            }
        }
    }
    if (isset($panels_array['year'])) { rsort($panels_array['year']); }
    
    return $panels_array;
}


I will add option to cut cast to choosen count of actors.
Reply


Messages In This Thread
RE: MovieLib - Your movie database on web - by Regss - 2017-02-27, 13:01
Last Post - by Jeffreywat - 2017-09-03, 14:02
Logout Mark Read Team Forum Stats Members Help
MovieLib - Your movie database on web8