Aşağıda bu hata alıyorum ve bu nedir merak ediyorum? Ve ben bunu düzeltmek için ne yapabilirim?
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 ') AND articles_comments.user_id IN()' at line 6
İşte benim MySQL kodudur.
$u_id2 = array();
$dbc = mysqli_query($mysqli,"SELECT users.user_id FROM users WHERE users.active IS NOT NULL OR users.deletion = 1");
if(!$dbc){
print mysqli_error($mysqli);
} else {
while($row = mysqli_fetch_assoc($dbc)) {
$u_id2[] = $row['user_id'];
}
}
$bad_com_id2 = array();
$dbc = mysqli_query($mysqli,"SELECT articles_comments.comment_id
FROM articles_comments
WHERE articles_comments.user_id IN(" . implode(",", $u_id2) . ")
AND articles_comments.parent_comment_id = 0");
if(!$dbc){
print mysqli_error($mysqli);
} else {
while($row = mysqli_fetch_assoc($dbc)) {
$bad_com_id2[] = $row['comment_id' ];
}
}
$com_id2 = array();
$ucom_id2 = array();
$dbc = mysqli_query($mysqli,"SELECT articles_comments.comment_id, articles_comments.user_id FROM articles_comments WHERE articles_comments.article_id = '" . $article_id . "'");
if(!$dbc){
print mysqli_error($mysqli);
} else {
while($row = mysqli_fetch_assoc($dbc)) {
$com_id2[] = $row['comment_id' ];
$ucom_id2[] = $row['user_id'];
}
}
$comments_to_be_displayed2 = array_diff($ucom_id2, $u_id2);
$new_com_id2 = array();
$dbc = mysqli_query($mysqli,"SELECT articles_comments.comment_id
FROM articles_comments
INNER JOIN users ON articles_comments.user_id = users.user_id
INNER JOIN users_articles ON articles_comments.article_id = users_articles.id
WHERE articles_comments.article_id = '" . $article_id . "'
AND articles_comments.comment_id IN(" . implode(",", $com_id2) . ")
AND articles_comments.user_id IN(" . implode(",", $comments_to_be_displayed2) . ")");
if(!$dbc){
print mysqli_error($mysqli);
} else {
while($row = mysqli_fetch_assoc($dbc)) {
$new_com_id2[] = $row['comment_id' ];
}
}