aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2012-11-09 07:45:23 -0600
committerNathaniel Guse <nathaniel.guse@gmail.com>2012-11-09 07:45:23 -0600
commitb8bdcc957bc49b96d43d74077c95a55f4f88e2fa (patch)
tree000615821b0f49567185bb6f6b34f6df2025fe2d /phpBB
parentf09ee162528d931aabc3f216410d02d3a072c21d (diff)
downloadforums-b8bdcc957bc49b96d43d74077c95a55f4f88e2fa.tar
forums-b8bdcc957bc49b96d43d74077c95a55f4f88e2fa.tar.gz
forums-b8bdcc957bc49b96d43d74077c95a55f4f88e2fa.tar.bz2
forums-b8bdcc957bc49b96d43d74077c95a55f4f88e2fa.tar.xz
forums-b8bdcc957bc49b96d43d74077c95a55f4f88e2fa.zip
[ticket/11103] count is reserved, do not use in a SQL query
PHPBB3-11103
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/notification/manager.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php
index 102623ab93..ca018fbf3b 100644
--- a/phpBB/includes/notification/manager.php
+++ b/phpBB/includes/notification/manager.php
@@ -122,25 +122,25 @@ class phpbb_notification_manager
if ($options['count_unread'])
{
// Get the total number of unread notifications
- $sql = 'SELECT COUNT(*) AS count
+ $sql = 'SELECT COUNT(*) AS unread_count
FROM ' . NOTIFICATIONS_TABLE . '
WHERE user_id = ' . (int) $options['user_id'] . '
AND unread = 1
AND is_enabled = 1';
$result = $this->db->sql_query($sql);
- $unread_count = (int) $this->db->sql_fetchfield('count', $result);
+ $unread_count = (int) $this->db->sql_fetchfield('unread_count', $result);
$this->db->sql_freeresult($result);
}
if ($options['count_total'])
{
// Get the total number of notifications
- $sql = 'SELECT COUNT(*) AS count
+ $sql = 'SELECT COUNT(*) AS total_count
FROM ' . NOTIFICATIONS_TABLE . '
WHERE user_id = ' . (int) $options['user_id'] . '
AND is_enabled = 1';
$result = $this->db->sql_query($sql);
- $total_count = (int) $this->db->sql_fetchfield('count', $result);
+ $total_count = (int) $this->db->sql_fetchfield('total_count', $result);
$this->db->sql_freeresult($result);
}
@@ -675,7 +675,7 @@ class phpbb_notification_manager
// If no method, make sure that no other notification methods for this item are selected before deleting
if ($method === '')
{
- $sql = 'SELECT COUNT(*) as count
+ $sql = 'SELECT COUNT(*) as num_notifications
FROM ' . USER_NOTIFICATIONS_TABLE . "
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
AND item_id = " . (int) $item_id . '
@@ -683,10 +683,10 @@ class phpbb_notification_manager
AND method <> ''
AND notify = 1";
$this->db->sql_query($sql);
- $count = $this->db->sql_fetchfield('count');
+ $num_notifications = $this->db->sql_fetchfield('num_notifications');
$this->db->sql_freeresult();
- if ($count)
+ if ($num_notifications)
{
return;
}