Welcome Guest, Not a member yet? Register   Sign In
Need help related to my codeigniter wallpaper script
#38

(This post was last modified: 04-07-2018, 11:56 AM by jreklund.)

Can you run these in phpmyadmin or similar and screenshot the results. I'm afraid it's too hard to actually see how it's behaving.

Code:
SELECT `wp`.`category_seq_id` as `wpcid`, `w`.* FROM `WS_wallpapers_path` `wp` JOIN `WS_wallpapers` `w` ON `w`.`wallpaper_seq_id` = `wp`.`wallpaper_seq_id` LEFT JOIN (SELECT `tv_views_count` as `total_views`, `tv_wid` as `wv_wid` FROM `WS_wallpapers_temp_views`) as v ON `v`.`wv_wid` = `w`.`wallpaper_seq_id` GROUP BY `wp`.`category_seq_id` ORDER BY `total_views` DESC

Code:
SELECT `w`.*, `t2`.*, GROUP_CONCAT(c.category_slug order by c1.lvl desc SEPARATOR '/') AS cFullSlug, GROUP_CONCAT(c.category_name order by c1.lvl desc SEPARATOR '|') AS cFullName FROM `WS_closures` `c1` LEFT JOIN `WS_category` `c` ON `c`.`category_seq_id` = `c1`.`ancestor` LEFT JOIN `WS_category` `t2` ON `t2`.`category_seq_id` = `c1`.`descendant` LEFT JOIN (
SELECT `wp`.`category_seq_id` as `wpcid`, `w`.* FROM `WS_wallpapers_path` `wp` JOIN `WS_wallpapers` `w` ON `w`.`wallpaper_seq_id` = `wp`.`wallpaper_seq_id` LEFT JOIN (SELECT `tv_views_count` as `total_views`, `tv_wid` as `wv_wid` FROM `WS_wallpapers_temp_views`) as v ON `v`.`wv_wid` = `w`.`wallpaper_seq_id` GROUP BY `wp`.`category_seq_id` ORDER BY `total_views` DESC
) as w ON `w`.`wpcid` = `c`.`category_seq_id` WHERE `w`.`wallpaper_seq_id` IS NOT NULL GROUP BY `c1`.`descendant` ORDER BY `t2`.`category_name` ASC

PHP Code:
public function get_parent_categories()
    {
        
$views $this->wallpaperViews();
        
$this->db->select('wp.category_seq_id as wpcid,w.*');
        
$this->db->from('wallpapers_path wp');
        
$this->db->join('wallpapers w''w.wallpaper_seq_id = wp.wallpaper_seq_id');
        
$this->db->join("($views) as v"'v.wv_wid = w.wallpaper_seq_id''left');
        
$this->db->group_by('wp.category_seq_id');
        
$this->db->order_by('wp.wp_seq_id''desc'); // This is just a wild guess
        
$this->db->order_by('total_views''desc');
        
$wallpaper_sql $this->sql();

        
$this->db->select('w.*');
        
$this->wallCatTemplate(false);
        
$this->db->join("($wallpaper_sql) as w"'w.wpcid = c.category_seq_id''left');
        
$this->db->where('w.wallpaper_seq_id IS NOT NULL');
        
$this->db->order_by('t2.category_name''asc');
        return 
$this->result();
    } 

PHP Code:
public function get_parent_categories()
    {
        
$views $this->wallpaperViews();
        
$this->db->select('wp.category_seq_id as wpcid,w.*');
        
$this->db->from('wallpapers_path wp');
        
$this->db->join('wallpapers w''w.wallpaper_seq_id = wp.wallpaper_seq_id');
        
$this->db->join("($views) as v"'v.wv_wid = w.wallpaper_seq_id''left');
        
$this->db->group_by('wp.category_seq_id');
        
$this->db->order_by('w.wallpaper_seq_id''desc'); // Another guess
        
$this->db->order_by('total_views''desc');
        
$wallpaper_sql $this->sql();

        
$this->db->select('w.*');
        
$this->wallCatTemplate(false);
        
$this->db->join("($wallpaper_sql) as w"'w.wpcid = c.category_seq_id''left');
        
$this->db->where('w.wallpaper_seq_id IS NOT NULL');
        
$this->db->order_by('t2.category_name''asc');
        return 
$this->result();
    } 
Reply


Messages In This Thread
RE: Need help related to my codeigniter wallpaper script - by jreklund - 04-07-2018, 11:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB