строка 139
Код: Выделить всё
// Get all the important topic info.
$request = db_query("
SELECT
t.numReplies, t.numViews, t.locked, ms.subject, t.isSticky, t.ID_POLL,
t.ID_MEMBER_STARTED, t.ID_FIRST_MSG, t.ID_LAST_MSG,
" . ($user_info['is_guest'] ? '0' : 'IFNULL(lt.ID_MSG, -1) + 1') . " AS new_from
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS ms)" . ($user_info['is_guest'] ? '' : "
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = $topic AND lt.ID_MEMBER = $ID_MEMBER)") ."
WHERE t.ID_TOPIC = $topic
AND ms.ID_MSG = t.ID_FIRST_MSG
LIMIT 1", __FILE__, __LINE__);
if (mysql_num_rows($request) == 0)
fatal_lang_error(472, false);
$topicinfo = mysql_fetch_assoc($request);
mysql_free_result($request);
// The start isn't a number; it's information about what to do, where to go.
там может $topic быть не определено, переделываю не много движок....
меняю на:
(добавил запрос и переопределил $topic )
Код: Выделить всё
// Get all the important topic info.
$request = db_query("
SELECT
t.numReplies, t.numViews, t.locked, ms.subject, t.isSticky, t.ID_POLL,
t.ID_MEMBER_STARTED, t.ID_FIRST_MSG, t.ID_LAST_MSG,
" . ($user_info['is_guest'] ? '0' : 'IFNULL(lt.ID_MSG, -1) + 1') . " AS new_from
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS ms)" . ($user_info['is_guest'] ? '' : "
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = $topic AND lt.ID_MEMBER = $ID_MEMBER)") ."
WHERE t.ID_TOPIC = $topic
AND ms.ID_MSG = t.ID_FIRST_MSG
LIMIT 1", __FILE__, __LINE__);
if (mysql_num_rows($request) == 0)
// fatal_lang_error(472, false);
$topicinfo = mysql_fetch_assoc($request);
mysql_free_result($request);
$request2 = db_query("
SELECT true_topic
FROM bad_topic
WHERE bad_topic = " .$_GET['topic'] ." LIMIT 1 " , __FILE__, __LINE__);
//$user_settings = mysql_fetch_assoc($request2);
while ($row = mysql_fetch_assoc($request2))
{
$topic2 = $row['true_topic'];
// echo $row['true_topic'];
}
if ($topic2) {
$topic = $topic2;
}
// The start isn't a number; it's information about what to do, where to go.
мне выдает ошибку движок
Код: Выделить всё
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 'AS isRead
FROM smf_sdfmessages
WHERE ID_MSG IN (7724)
ORDER BY ID_MSG' at line 4
File: /home/mydm/www/data/Sources/Display.php
Line: 760
ORDER BY ID_MSG" . (empty($options['view_newest_first']) ? '' : ' DESC'), __FILE__, __LINE__);
полностью:
Код: Выделить всё
if (!empty($posters))
loadMemberData($posters);
$messages_request = db_query("
SELECT
ID_MSG, icon, subject, posterTime, posterIP, ID_MEMBER, modifiedTime, modifiedName, body,
smileysEnabled, posterName, posterEmail, k_os, k_br, k_os_ico, k_br_ico,
ID_MSG_MODIFIED < $topicinfo[new_from] AS isRead
FROM {$db_prefix}messages
WHERE ID_MSG IN (" . implode(',', $messages) . ")
ORDER BY ID_MSG" . (empty($options['view_newest_first']) ? '' : ' DESC'), __FILE__, __LINE__);
// Go to the last message if the given time is beyond the time of the last message.
if (isset($context['start_from']) && $context['start_from'] >= $topicinfo['numReplies'])
$context['start_from'] = $topicinfo['numReplies'];