Fixed news count in news.php not being provided.
This commit is contained in:
parent
c107b691c5
commit
17463088dd
1 changed files with 12 additions and 2 deletions
|
@ -90,7 +90,12 @@ if ($categoryId !== null) {
|
||||||
p.`post_id`, p.`post_title`, p.`post_text`, p.`created_at`,
|
p.`post_id`, p.`post_title`, p.`post_text`, p.`created_at`,
|
||||||
c.`category_id`, c.`category_name`,
|
c.`category_id`, c.`category_name`,
|
||||||
u.`user_id`, u.`username`,
|
u.`user_id`, u.`username`,
|
||||||
COALESCE(u.`user_colour`, r.`role_colour`) as `user_colour`
|
COALESCE(u.`user_colour`, r.`role_colour`) as `user_colour`,
|
||||||
|
(
|
||||||
|
SELECT COUNT(`comment_id`)
|
||||||
|
FROM `msz_comments_posts`
|
||||||
|
WHERE `category_id` = `comment_section_id`
|
||||||
|
) as `post_comments`
|
||||||
FROM `msz_news_posts` as p
|
FROM `msz_news_posts` as p
|
||||||
LEFT JOIN `msz_news_categories` as c
|
LEFT JOIN `msz_news_categories` as c
|
||||||
ON p.`category_id` = c.`category_id`
|
ON p.`category_id` = c.`category_id`
|
||||||
|
@ -156,7 +161,12 @@ $getPosts = Database::prepare('
|
||||||
p.`post_id`, p.`post_title`, p.`post_text`, p.`created_at`,
|
p.`post_id`, p.`post_title`, p.`post_text`, p.`created_at`,
|
||||||
c.`category_id`, c.`category_name`,
|
c.`category_id`, c.`category_name`,
|
||||||
u.`user_id`, u.`username`,
|
u.`user_id`, u.`username`,
|
||||||
COALESCE(u.`user_colour`, r.`role_colour`) as `user_colour`
|
COALESCE(u.`user_colour`, r.`role_colour`) as `user_colour`,
|
||||||
|
(
|
||||||
|
SELECT COUNT(`comment_id`)
|
||||||
|
FROM `msz_comments_posts`
|
||||||
|
WHERE `category_id` = `comment_section_id`
|
||||||
|
) as `post_comments`
|
||||||
FROM `msz_news_posts` as p
|
FROM `msz_news_posts` as p
|
||||||
LEFT JOIN `msz_news_categories` as c
|
LEFT JOIN `msz_news_categories` as c
|
||||||
ON p.`category_id` = c.`category_id`
|
ON p.`category_id` = c.`category_id`
|
||||||
|
|
Loading…
Add table
Reference in a new issue