Страница 3 из 3

Re: Users Reputations System

Добавлено: 20.04.2009 13:16
Fine
при удалении топика

Код: Выделить всё

Could not update user post count information

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '02 WHERE user_id = 809' at line 2

SELECT poster_id, COUNT(post_id) AS posts FROM bt_posts WHERE topic_id IN (195237) GROUP BY poster_id

Line : 327
File : modcp.php

Код: Выделить всё

			$sql = "SELECT poster_id, COUNT(post_id) AS posts
				FROM " . POSTS_TABLE . "
				WHERE topic_id IN ($topic_id_sql)
				GROUP BY poster_id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not get poster id information', '', __LINE__, __FILE__, $sql);
			}
			$count_sql = array();
			while ( $row = $db->sql_fetchrow($result) )
			{
				$rep = ($rep_config['posts_to_earn'] != 0) ? (1/$rep_config['posts_to_earn']) : 0;
				$count_sql[] = "UPDATE " . USERS_TABLE . " 
					SET user_posts = user_posts - " . $row['posts'] . ", user_reputation = user_reputation - " . $rep . "
					WHERE user_id = " . $row['poster_id'];
			}
			$db->sql_freeresult($result);

			if ( sizeof($count_sql) )
			{
				for($i = 0; $i < sizeof($count_sql); $i++)
				{
					if ( !$db->sql_query($count_sql[$i]) )
					{
						message_die(GENERAL_ERROR, 'Could not update user post count information', '', __LINE__, __FILE__, $sql);
					}
				}
			}
Как поправить?