Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2006
    Posts
    37
    Plugin Contributions
    0

    Default SQL error when sending newsletter to emails with '

    Have an email that has an apostrophe in it...and when sending newsletters, I get the following error (i've edited the actual domain of the email address):


    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 '[email protected]'' at line 1
    in:
    [select customers_email_format from customers where customers_email_address= 'joseph.o'[email protected]']
    If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

  2. #2
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: SQL error when sending newsletter to emails with '

    Which ZC version is it?
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  3. #3
    Join Date
    Aug 2006
    Posts
    37
    Plugin Contributions
    0

    Default Re: SQL error when sending newsletter to emails with '

    sorry, running 1.3.7

  4. #4
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: SQL error when sending newsletter to emails with '

    Edit:
    includes/functions/functions_email.php

    Replace line 136:
    PHP Code:
          $sql $db->bindVars($sql':custEmailAddress:'$to_email_address'string'); 
    by
    PHP Code:
          $sql $db->bindVars($sql':custEmailAddress:'zen_db_input($to_email_address), 'string'); 
    See if that helps.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  5. #5
    Join Date
    Aug 2006
    Posts
    37
    Plugin Contributions
    0

    Default Re: SQL error when sending newsletter to emails with '

    I couldn't find that line of code in the file specified...

  6. #6
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: SQL error when sending newsletter to emails with '

    You were given the wrong answer.

    Change this section (approx line 115):
    Code:
          $customers_email_format_read = $db->Execute("select customers_email_format from " . TABLE_CUSTOMERS . " where customers_email_address= '" . $to_email_address . "'");
          $customers_email_format = $customers_email_format_read->fields['customers_email_format'];
          if ($customers_email_format=='NONE' || $customers_email_format=='OUT') return; //if requested no mail, then don't send.
          if ($customers_email_format =='HTML') $customers_email_format='HTML'; // if they opted-in to HTML messages, then send HTML format
    
          //determine what format to send messages in if this is an "extra"/admin-copy email:
          if (ADMIN_EXTRA_EMAIL_FORMAT == 'TEXT' && substr($module,-6)=='_extra') {
            $email_html='';  // just blank out the html portion if admin has selected text-only
          }
    to this:
    Code:
          $sql = "select customers_email_format from " . TABLE_CUSTOMERS . " where customers_email_address= :custEmailAddress:";
          $sql = $db->bindVars($sql, ':custEmailAddress:', $to_email_address, 'string');
          $result = $db->Execute($sql);
          $customers_email_format = ($result->RecordCount() > 0) ? $result->fields['customers_email_format'] : '';
          if ($customers_email_format == 'NONE' || $customers_email_format == 'OUT') return; //if requested no mail, then don't send.
    //      if ($customers_email_format == 'HTML') $customers_email_format = 'HTML'; // if they opted-in to HTML messages, then send HTML format
    
          // handling admin/"extra"/copy emails:
          if (ADMIN_EXTRA_EMAIL_FORMAT == 'TEXT' && substr($module,-6)=='_extra') {
            $email_html='';  // just blank out the html portion if admin has selected text-only
          }
          //determine what format to send messages in if this is an admin email for newsletters:
          if ($customers_email_format == '' && ADMIN_EXTRA_EMAIL_FORMAT == 'HTML' && in_array($module, array('newsletters', 'product_notification')) && isset($_SESSION['admin_id'])) {
            $customers_email_format = 'HTML';
          }
    This gives you the code used in v1.3.8 ... which is worth upgrading your site to ...
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Aug 2006
    Posts
    37
    Plugin Contributions
    0

    Default Re: SQL error when sending newsletter to emails with '

    thanks drbyte...will be upgrading to 1.3.8 soon

 

 

Similar Threads

  1. v151 Question about sending Newsletter Emails
    By gold in forum General Questions
    Replies: 2
    Last Post: 13 Jul 2014, 03:01 AM
  2. v139h Error 500 when sending mass emails
    By lissa in forum General Questions
    Replies: 17
    Last Post: 25 Nov 2012, 01:39 PM
  3. Email Newsletter Problems with Sending HTML Emails
    By WiccanWitch420 in forum General Questions
    Replies: 14
    Last Post: 1 Sep 2011, 10:25 PM
  4. Replies: 5
    Last Post: 5 Jan 2010, 09:07 PM
  5. paypal express error when sending emails
    By lucianman in forum General Questions
    Replies: 1
    Last Post: 6 Jan 2007, 01:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg