Erreur lors d'une tentative de deplacement d'un message sur un forum php
3 réponses
V
Bonjour
Je n'arrive pas à deplacer les messages sur mon forum.
Voici l'erreur :
Couldn't select Post ID's
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
'GROUP BY post_id' at line 2
SELECT post_id FROM phpbb_posts WHERE topic_id = GROUP BY post_id
Line : 729
File :
/var/www/free.fr/5/6/forum.test/attach_mod/includes/functions_attach.php
Voici ce qu'il se trouve vers la ligne 729 du fichier function_attach.php
//
// Sync Topic
//
function attachment_sync_topic($topic_id)
{
global $db;
$sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE topic_id = " .
$topic_id . "
GROUP BY post_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Couldn\'t select Post ID\'s', '', __LINE__,
__FILE__, $sql);
}
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Franck Dupont
Bonjour
Je n'arrive pas à deplacer les messages sur mon forum.
Voici l'erreur :
Couldn't select Post ID's
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 'GROUP BY post_id' at line 2
SELECT post_id FROM phpbb_posts WHERE topic_id = GROUP BY post_id
La requête SQL est fausse : topic_id = ???
Line : 729 File : /var/www/free.fr/5/6/forum.test/attach_mod/includes/functions_attach.php
Voici ce qu'il se trouve vers la ligne 729 du fichier function_attach.php
// // Sync Topic // function attachment_sync_topic($topic_id) { global $db;
$sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE topic_id = " . $topic_id . " GROUP BY post_id";
Le problème se situe ci dessus : la variable $topic_id est vide .. d'ou l'erreur dans la requête. La requête correcte devrait être : SELECT post_id FROM phpbb_posts WHERE topic_id = 1 GROUP BY post_id
- Franck -
if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Couldn't select Post ID's', '', __LINE__, __FILE__, $sql); }
Je n'arrive pas à deplacer les messages sur mon forum.
Voici l'erreur :
Couldn't select Post ID's
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
'GROUP BY post_id' at line 2
SELECT post_id FROM phpbb_posts WHERE topic_id = GROUP BY post_id
La requête SQL est fausse : topic_id = ???
Line : 729
File :
/var/www/free.fr/5/6/forum.test/attach_mod/includes/functions_attach.php
Voici ce qu'il se trouve vers la ligne 729 du fichier function_attach.php
//
// Sync Topic
//
function attachment_sync_topic($topic_id)
{
global $db;
$sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE topic_id = " .
$topic_id . "
GROUP BY post_id";
Le problème se situe ci dessus : la variable $topic_id est vide .. d'ou
l'erreur dans la requête. La requête correcte devrait être :
SELECT post_id FROM phpbb_posts WHERE topic_id = 1 GROUP BY post_id
- Franck -
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Couldn't select Post ID's', '', __LINE__,
__FILE__, $sql);
}
Je n'arrive pas à deplacer les messages sur mon forum.
Voici l'erreur :
Couldn't select Post ID's
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 'GROUP BY post_id' at line 2
SELECT post_id FROM phpbb_posts WHERE topic_id = GROUP BY post_id
La requête SQL est fausse : topic_id = ???
Line : 729 File : /var/www/free.fr/5/6/forum.test/attach_mod/includes/functions_attach.php
Voici ce qu'il se trouve vers la ligne 729 du fichier function_attach.php
// // Sync Topic // function attachment_sync_topic($topic_id) { global $db;
$sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE topic_id = " . $topic_id . " GROUP BY post_id";
Le problème se situe ci dessus : la variable $topic_id est vide .. d'ou l'erreur dans la requête. La requête correcte devrait être : SELECT post_id FROM phpbb_posts WHERE topic_id = 1 GROUP BY post_id
- Franck -
if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Couldn't select Post ID's', '', __LINE__, __FILE__, $sql); }
SELECT post_id FROM phpbb_posts WHERE topic_id = GROUP BY post_id ...
$sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE topic_id = " . $topic_id . " GROUP BY post_id";
ici, $topic_id = '', maintenant, on ne peut pas savoir pq ...
P'tit Marcel
SELECT post_id FROM phpbb_posts WHERE topic_id = GROUP BY post_id
...
$sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE topic_id = " . $topic_id . " GROUP BY post_id";
ici, $topic_id = '', maintenant, on ne peut pas savoir pq ...
je soupçonne que la variable vient du client (POST ou GET) et que register globals est à OFF.
au passage, pour utiliser une variable issue du client dans une requête SQL, il faut impérativement l'enclore de " ou ' même si la variable est numérique. Sinon faille de sécurité
SELECT post_id FROM phpbb_posts WHERE topic_id = GROUP BY post_id
...
$sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE topic_id = " .
$topic_id . "
GROUP BY post_id";
ici, $topic_id = '', maintenant, on ne peut pas savoir pq ...
je soupçonne que la variable vient du client (POST ou GET) et que
register globals est à OFF.
au passage, pour utiliser une variable issue du client dans une requête
SQL, il faut impérativement l'enclore de " ou ' même si la variable est
numérique. Sinon faille de sécurité
SELECT post_id FROM phpbb_posts WHERE topic_id = GROUP BY post_id
...
$sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE topic_id = " . $topic_id . " GROUP BY post_id";
ici, $topic_id = '', maintenant, on ne peut pas savoir pq ...
je soupçonne que la variable vient du client (POST ou GET) et que register globals est à OFF.
au passage, pour utiliser une variable issue du client dans une requête SQL, il faut impérativement l'enclore de " ou ' même si la variable est numérique. Sinon faille de sécurité