We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30585
    • 833 Posts
    Hi guys, I’m using Easy Newsletter on a French website and the implementation went fine. When I try to create a newsletter, I get the message below. I should point out that my HTML code uses French accents like é... Everything works fine when I’m using an English content

    The Error:
    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « Execution of a query to the database failed - 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 'objet de deux ouvrages que nous avons publiés chez PUBLISUD en juillet 20' at line 1 »
          SQL: INSERT INTO easynewsletter_newsletter VALUES('', now(), '','', '', 'test', '


    The HTML

      <p>Les  principaux thèmes développés dans ce site font l'objet de deux ouvrages  que nous avons publiés chez PUBLISUD en juillet 2001 ("<a title="Refaire la république" href="http://pjx.itconsmedia.net/UNIR/refaire-la-republique.html">Congo-Zaïre - Refaire la République - Mission sacrée d'une génération</a> ") et en janvier 2003 ("<a title="Notre cause" href="http://pjx.itconsmedia.net/UNIR/notre-cause.html">Congo-Zaïre - Notre Cause - Le message et les ambitions d'une juste cause</a>"). Ce dernier ouvrage approfondissant entre autres les points saillants qui sont développés dans notre "<a title="Agenda 2002 pour la paix" href="http://pjx.itconsmedia.net/UNIR/notre-cause/ambition-paix-securite/agenda-fra.html">Agenda  2002 pour la paix dans la Région des Grands lacs, la restauration de  l'intégrité territoriale et le rétablissement de la République au  Congo-Zaïre</a>" (mars 2002).</p>


    Please help!
      A MODx Fanatic
      • 30884
      • 142 Posts
      It’s possible that it’s not being escaped or validated as you’d expect with the &ecutes in there. Is it possible that Modx is being confused by these &amps or the quotations in there ( " ) and ( ’ ) are not happy either.

      Just a thought, sorry couldn’t help much more. Try plain word or two in there with out each of the above mentioned elements and see what works best (if at all).
      Cheers

      TxRx

      l'ob
      is probably the problem since it’s the 1st apostrophe in the string.
        p i x e l p u s h e r e x t r o d i n a i r e
        A x i s A n i m a t i o n . c o m
        • 30585
        • 833 Posts
        Quote from: TXRX at Jan 09, 2009, 09:19 AM

        It’s possible that it’s not being escaped or validated as you’d expect with the &ecutes in there. Is it possible that Modx is being confused by these &amps or the quotations in there ( " ) and ( ’ ) are not happy either.

        Just a thought, sorry couldn’t help much more. Try plain word or two in there with out each of the above mentioned elements and see what works best (if at all).
        Cheers

        TxRx

        l'ob
        is probably the problem since it’s the 1st apostrophe in the string.

        Thanks for the suggestion. I also think that the issue is related special characters. It just doesn’t make any sense why, especially when I’m using TinyMCE
          A MODx Fanatic
          • 30884
          • 142 Posts
          Hm.. There’s my weakpoint, I’m not able to say how TinyMCE is handling the string, I’m not using it all here.

          The errors point to that being the point of failure at least. try it without apostrophies, just to see if it works as it should.
          ( well, it’ll rather show that’s where the problem resides or not ).
          Cheers.

          TxRx
            p i x e l p u s h e r e x t r o d i n a i r e
            A x i s A n i m a t i o n . c o m
            • 4310
            • 2,310 Posts
            Try replacing this (lines 190 - 201) :
            // Insert newsletter into database
            		$sql = "INSERT INTO easynewsletter_newsletter VALUES('', now(), '','', '', '".$_POST['subject']."', '".$testo."', '') ";
            		$result = $modx->db->query($sql);
            		echo $lang_newsletter_edit_create;
            	} elseif ($_GET['action'] == 5) {
            		// Update existing newsletter
            				// insert correct path for images
            		$testo = ereg_replace('src="assets/images/','src="'.$site_url.'assets/images/',$_POST['tvmailMessage']);
            
            		$sql = "UPDATE easynewsletter_newsletter SET subject='".$_POST['subject']."', newsletter='".$testo."' WHERE id='".$_POST['xid']."'";
            		$result = $modx->db->query($sql);
            		echo $lang_newsletter_edit_update;

            With this :
            		// Insert newsletter into database
            		$sql = "INSERT INTO easynewsletter_newsletter VALUES('', now(), '','', '', '".$_POST['subject']."', '".mysql_real_escape_string($testo)."', '') ";
            		$result = $modx->db->query($sql);
            		echo $lang_newsletter_edit_create;
            	} elseif ($_GET['action'] == 5) {
            		// Update existing newsletter
            				// insert correct path for images
            		$testo = ereg_replace('src="assets/images/','src="'.$site_url.'assets/images/',$_POST['tvmailMessage']);
            
            		$sql = "UPDATE easynewsletter_newsletter SET subject='".$_POST['subject']."', newsletter`='".mysql_real_escape_string($testo)."' WHERE id='".$_POST['xid']."'";
            		$result = $modx->db->query($sql);
            		echo $lang_newsletter_edit_update;

            Worked for me with special characters wink