Page 1 sur 1

Erreur Mysql incompréhensible

Posté : 29 janv. 2009, 12:41
par bull955
Bonjour,

J'utilise les fonctions Dreamweaver pour mettre à jour des enregistrement dans des tables Joomla, sur 12 tables, donc 12 pages, il y en a une qui me produit un erreur mysql alors qu'elle est conçue exactement comme les autres. Je suppose que le contenu des champs ne doit pas lui convenir, mais je ne sais pas quoi... :(
l'erreur :
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 'fulltext=NULL, images='IMAGES/femme005.gif', catid=8, `alias`='latelier', title_' at line 1
le code de mise à jour :

Code : Tout sélectionner

<?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE jos_content SET title=%s, introtext=%s, fulltext=%s, images=%s, catid=%s, `alias`=%s, title_alias=%s, `state`=%s, sectionid=%s, mask=%s, created=%s, created_by=%s, created_by_alias=%s, modified=%s, modified_by=%s, checked_out=%s, checked_out_time=%s, publish_up=%s, publish_down=%s, urls=%s, attribs=%s, version=%s, parentid=%s, ordering=%s, metakey=%s, metadesc=%s, `access`=%s, hits=%s, metadata=%s WHERE id=%s", GetSQLValueString($_POST['title'], "text"), GetSQLValueString($_POST['introtext'], "text"), GetSQLValueString($_POST['fulltext'], "text"), GetSQLValueString($_POST['images'], "text"), GetSQLValueString($_POST['catid'], "int"), GetSQLValueString($_POST['alias'], "text"), GetSQLValueString($_POST['title_alias'], "text"), GetSQLValueString($_POST['state'], "int"), GetSQLValueString($_POST['sectionid'], "int"), GetSQLValueString($_POST['mask'], "int"), GetSQLValueString($_POST['created'], "text"), GetSQLValueString($_POST['created_by'], "int"), GetSQLValueString($_POST['created_by_alias'], "text"), GetSQLValueString($_POST['modified'], "text"), GetSQLValueString($_POST['modified_by'], "int"), GetSQLValueString($_POST['checked_out'], "int"), GetSQLValueString($_POST['checked_out_time'], "date"), GetSQLValueString($_POST['publish_up'], "text"), GetSQLValueString($_POST['publish_down'], "text"), GetSQLValueString($_POST['urls'], "text"), GetSQLValueString($_POST['attribs'], "text"), GetSQLValueString($_POST['version'], "int"), GetSQLValueString($_POST['parentid'], "int"), GetSQLValueString($_POST['ordering'], "int"), GetSQLValueString($_POST['metakey'], "text"), GetSQLValueString($_POST['metadesc'], "text"), GetSQLValueString($_POST['access'], "int"), GetSQLValueString($_POST['hits'], "int"), GetSQLValueString($_POST['metadata'], "text"), GetSQLValueString($_POST['id'], "int")); mysql_select_db($database_CnxOrigines, $CnxOrigines); $Result1 = mysql_query($updateSQL, $CnxOrigines) or die(mysql_error()); } mysql_select_db($database_CnxOrigines, $CnxOrigines); $query_RecListeCateg = "SELECT jos_categories.id, jos_categories.title FROM jos_categories WHERE jos_categories.ordering < 11 ORDER BY jos_categories.ordering ASC"; $RecListeCateg = mysql_query($query_RecListeCateg, $CnxOrigines) or die(mysql_error()); $row_RecListeCateg = mysql_fetch_assoc($RecListeCateg); $totalRows_RecListeCateg = mysql_num_rows($RecListeCateg); mysql_select_db($database_CnxOrigines, $CnxOrigines); $query_RecUneCateg = "SELECT * FROM jos_content WHERE jos_content.catid='$id' "; $RecUneCateg = mysql_query($query_RecUneCateg, $CnxOrigines) or die(mysql_error()); $row_RecUneCateg = mysql_fetch_assoc($RecUneCateg); $totalRows_RecUneCateg = mysql_num_rows($RecUneCateg); ?>
Au départ j'ai pensé qu'il digérait mal les dates, je les ai remplacé par "text", mais ça ne change rien.

Dans le contenu des champs, il y a des textes, des dates, des "=", des chemins vers des images, et des entiers.

Alors serait-ce les "/" des chemins qu'il n'aime pas ou bien les "=" ?

Merci d'avance pour votre aide.

Posté : 29 janv. 2009, 13:28
par @rthur
Bonjour,

Fais afficher ta requête SQL dans ton or die pour voir la requête exacte qui plante.
Si tu ne vois toujours pas le problème, teste ta requête problématique dans phpMyAdmin

Posté : 29 janv. 2009, 14:48
par Invité
Quelle truffe !

Merci arthur :)

biensur qu'en la testant dans phpmyadmin j'aurais des infos plus précises. c'est ça d'avoir la tête dans le guidon sans jamais la lever !

Posté : 29 janv. 2009, 14:54
par Invité
Bon ben je ne suis pas bien plus avancé :(

L'erreur dans phpmyadmin est la même que dans dreamweaver...

Code : Tout sélectionner

Erreur requête SQL: UPDATE jos_content SET title = 'L\'Atelier', introtext = 'Lieu de création privilégié. De l\'imaginaire à la matière. De la composition à la réalisation. Je pars d\'un croquis au gré de mes envies.', FULLTEXT = 'blabla', images = 'IMAGES/femme005.gif', catid =8, `alias` = 'latelier', title_alias = NULL , `state` =1, sectionid =2, mask =0, created = '2008-12-07 17:39:55', created_by =62, created_by_alias = NULL , modified = '2008-12-07 18:07:57', modified_by =62, checked_out =0, checked_out_time = '0000-00-00 00:00:00', publish_up = '2008-12-07 17:39:55', publish_down = '0000-00-00 00:00:00', urls = NULL , attribs = 'show_title= link_titles= show_intro= show_section= link_section= show_category= link_category= show_vote= show_author= show_create_date= show_modify_date= show_pdf_icon= show_print_icon= show_email_icon= language= keyref= readmore=', version =4, parentid =0, ordering =1, metakey = NULL , metadesc = NULL , `access` =0, hits =18, metadata = 'robots= author=' WHERE id =4 MySQL a répondu:Documentation #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 'fulltext='blabla', images='IMAGES/femme005.gif', catid=8, `alias`='latelier', ti' at line 1

Posté : 29 janv. 2009, 14:57
par albat
FULLTEXT ne serait-il pas un mot réservé ?... :roll:

Posté : 29 janv. 2009, 16:35
par @rthur

Posté : 29 janv. 2009, 19:53
par Invité
Arf !!!

Je ne peux pas changer l'intitulé de la rubrique (Joomla oblige) alors comment faire ?

Posté : 29 janv. 2009, 20:13
par albat
Grrr... Vraiment du travail de goret... :evil:

Bon, puisque tu ne peux pas renommer le champ,
il ne te reste plus qu'à l'inscrire entre apostrophes anglais.

Comme c'est déjà le cas pour le champ alias, deux lignes plus bas.

Code : Tout sélectionner

`FULLTEXT` = 'blabla',