Be explicit when id column is ambiguous

master
Théophile Helleboid - chtitux 6 years ago
parent a0d332326c
commit c70dc852a1

@ -141,7 +141,7 @@ class CCache {
$sth = $pdo->prepare("SELECT SUM(value) AS sv $sth = $pdo->prepare("SELECT SUM(value) AS sv
FROM ttrss_counters_cache, ttrss_feeds FROM ttrss_counters_cache, ttrss_feeds
WHERE id = feed_id AND WHERE ttrss_feeds.id = feed_id AND
(cat_id = :cat OR (:cat = 0 AND cat_id IS NULL)) AND (cat_id = :cat OR (:cat = 0 AND cat_id IS NULL)) AND
ttrss_counters_cache.owner_uid = :uid AND ttrss_counters_cache.owner_uid = :uid AND
ttrss_feeds.owner_uid = :uid"); ttrss_feeds.owner_uid = :uid");

@ -24,11 +24,11 @@ class Counters {
$pdo = DB::pdo(); $pdo = DB::pdo();
$sth = $pdo->prepare("SELECT id AS cat_id, value AS unread, $sth = $pdo->prepare("SELECT ttrss_feed_categories.id AS cat_id, value AS unread,
(SELECT COUNT(id) FROM ttrss_feed_categories AS c2 (SELECT COUNT(id) FROM ttrss_feed_categories AS c2
WHERE c2.parent_cat = ttrss_feed_categories.id) AS num_children WHERE c2.parent_cat = ttrss_feed_categories.id) AS num_children
FROM ttrss_feed_categories, ttrss_cat_counters_cache FROM ttrss_feed_categories, ttrss_cat_counters_cache
WHERE ttrss_cat_counters_cache.feed_id = id AND WHERE ttrss_cat_counters_cache.feed_id = ttrss_feed_categories.id AND
ttrss_cat_counters_cache.owner_uid = ttrss_feed_categories.owner_uid AND ttrss_cat_counters_cache.owner_uid = ttrss_feed_categories.owner_uid AND
ttrss_feed_categories.owner_uid = ?"); ttrss_feed_categories.owner_uid = ?");
$sth->execute([$_SESSION['uid']]); $sth->execute([$_SESSION['uid']]);
@ -172,7 +172,7 @@ class Counters {
FROM ttrss_feeds, ttrss_counters_cache FROM ttrss_feeds, ttrss_counters_cache
WHERE ttrss_feeds.owner_uid = ? WHERE ttrss_feeds.owner_uid = ?
AND ttrss_counters_cache.owner_uid = ttrss_feeds.owner_uid AND ttrss_counters_cache.owner_uid = ttrss_feeds.owner_uid
AND ttrss_counters_cache.feed_id = id"); AND ttrss_counters_cache.feed_id = ttrss_feeds.id");
$sth->execute([$_SESSION['uid']]); $sth->execute([$_SESSION['uid']]);
while ($line = $sth->fetch()) { while ($line = $sth->fetch()) {

Loading…
Cancel
Save