7tooz Posted September 7, 2010 Posted September 7, 2010 I am posting this here because it doesn't seemed to be fixed within the contributions discussion: I added Simple_Visitor_Newsleter_With_HTML_Support-1.0 contribution, In admin/newsletters.php I get the following error when I send emails to "All Newsletter Subscribers". It shows the correct number of email addresses (Customer/Visitors) to send to, but it only will send it to the 1 email address I have listed as a full Customer address. The other 4 are visitor address I added through this contribution: visitor_mail_admin_JM Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /public_html/admin/includes/functions/database.php on line 99 Line # 98-100 function tep_db_fetch_array($db_query) { return mysql_fetch_array($db_query, MYSQL_ASSOC); } Any thought on how to fix this? Thnaks, 7tooz
7tooz Posted September 7, 2010 Author Posted September 7, 2010 OMG I think I figure this out. I just need someone to confirm the code structure. Was: function send($newsletter_id) { $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . customers . " where customers_newsletter = '1'"); $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); $mimemessage->add_text($this->content); $mimemessage->build_message(); while ($mail = tep_db_fetch_array($mail_query)) { $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title); } /////Simple Visitor Newsletter while ($visitor = tep_db_fetch_array($visitor_query)) { $mimemessage->send('7tooz - Visitor' . ' ' . 'Newsletter', $visitor['email'], '', EMAIL_FROM, $this->title); } /////Simple Visitor Newsletter $newsletter_id = tep_db_prepare_input($newsletter_id); tep_db_query("update " . newsletters . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'"); } Changed to: function send($newsletter_id) { $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . customers . " where customers_newsletter = '1'"); $visitor_query = tep_db_query("select * from " . visitor); $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); $mimemessage->add_text($this->content); $mimemessage->build_message(); while ($mail = tep_db_fetch_array($mail_query)) { $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title); } /////Simple Visitor Newsletter while ($visitor = tep_db_fetch_array($visitor_query)) { $mimemessage->send('7tooz - Visitor' . ' ' . 'Newsletter', $visitor['email'], '', EMAIL_FROM, $this->title); } /////Simple Visitor Newsletter $newsletter_id = tep_db_prepare_input($newsletter_id); tep_db_query("update " . newsletters . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'"); } Noticed there was no defining/selecting of the $visitor_query (added this line - $visitor_query = tep_db_query("select * from " . visitor); My error went away and the newsletters were sent to all of the customer/visitor addresses. Thanks, 7tooz
Recommended Posts
Archived
This topic is now archived and is closed to further replies.