functions post (Hide Zero Posters)
Geplaatst: 26 aug 2005, 13:35
ik wilde een post delete op mijn forum toe kreeg ik deze error
maar ik kreeg ook een sql error
functions post
dit is de install
maar ik kreeg ook een sql error
Code: Selecteer alles
UPDATE phpbb_users AS u, phpbb_posts AS p1 LEFT OUTER JOIN phpbb_posts AS p2 ON p1.poster_id = p2.poster_id AND p2.post_time < p1.post_time INNER JOIN phpbb_posts AS p3 ON p3.post_time = p1.post_time SET u.user_firstpost=p3.post_time WHERE p2.post_time IS NULL AND p1.poster_id = u.user_id
+++ Error: You have an error in your SQL syntax near 'AS u, phpbb_posts AS p1 LEFT OUTER JOIN phpbb_posts AS p2 ON p1.poster_' at line 1
functions post
Code: Selecteer alles
Unable to update user_firstpost
DEBUG MODE
SQL Error : 1064 You have an error in your SQL syntax near 'AS u, phpbb_posts AS p1 INNER JOIN phpbb_posts AS p2 ON p2.post_id = 2 ' at line 1
UPDATE phpbb_users AS u, phpbb_posts AS p1 INNER JOIN phpbb_posts AS p2 ON p2.post_id = 2 SET u.user_firstpost = 0 WHERE u.user_id = p2.poster_id AND u.user_firstpost = p2.post_time;
Line : 510
File : functions_post.php
dit is de install
Code: Selecteer alles
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND ]------------------------------------------
#
message_die(GENERAL_MESSAGE, $lang['Flood_Error']);
}
}
}
#
#-----[ AFTER, ADD ]------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . " SET user_firstpost = " . $current_time . "
WHERE user_id = " . $userdata['user_id'] . " AND user_firstpost = 0;";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Unable to update user_firstpost', '', __LINE__, __FILE__, $sql);
}
#
#-----[ FIND ]------------------------------------------
#
$sql = "DELETE FROM " . POSTS_TABLE . "
WHERE post_id = $post_id";
#
#-----[ BEFORE, ADD ]-----------------------------------
#
// if this is the users first post, set user_firstpost to 0.
$sql = "UPDATE " . USERS_TABLE . " AS u, " . POSTS_TABLE . " AS p1
INNER JOIN " . POSTS_TABLE . " AS p2
ON p2.post_id = " . $post_id . "
SET u.user_firstpost = 0
WHERE u.user_id = p2.poster_id AND u.user_firstpost = p2.post_time;";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Unable to update user_firstpost', '', __LINE__, __FILE__, $sql);
}
$resync = $db->sql_affectedrows();
#
#-----[ FIND ]------------------------------------------
#
$sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
WHERE post_id = $post_id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
#
#-----[ AFTER, ADD ]------------------------------------
#
if ($resync)
{
// if the previously deleted post was the users first post, redefine user_firstpost.
$sql = "UPDATE " . USERS_TABLE . " AS u, " . POSTS_TABLE . " AS p1
LEFT OUTER JOIN " . POSTS_TABLE . " AS p2
ON p1.poster_id = p2.poster_id AND p2.post_time < p1.post_time
INNER JOIN " . POSTS_TABLE . " AS p3
ON p3.post_time = p1.post_time
SET u.user_firstpost = p3.post_time
WHERE p2.post_time IS NULL AND p1.poster_id = u.user_id AND u.user_id = " . $post_data['poster_id'] .";";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Unable to update user_firstpost', '', __LINE__, __FILE__, $sql);
}
}