Newsletter Plugin MySql database query not working as hoped
2 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: January 27, 2017 (RSS)
By JeffC - January 27, 2017
Hi
I am trying to set up a database query so that a list is created to send to subscribers where Publication contains "MAG1" but not necessarily only MAG1.
For example:
MAG1 would be included in the list
MAG1 MAG2 would be included in the list
MAG2 would NOT be included in the list
After sending my message I received some failed delivery notices (as is normal) but I noticed some of the failed messages were from subscribers where publication is MAG2 only.
Please can someone tell me where I have gone wrong, here's my code:
SELECT contacts.num FROM <?php echo $TABLE_PREFIX ?>_nlb_subscribers AS subscribers
LEFT JOIN <?php echo $TABLE_PREFIX ?>contacts AS contacts
ON contacts.email_1_sales = subscribers.email
OR contacts.email_2_sales = subscribers.email
OR contacts.email_1_copy = subscribers.email
OR contacts.email_2_copy = subscribers.email
OR contacts.email_1_invoice = subscribers.email
OR contacts.email_2_invoice = subscribers.email
OR contacts.email_1_delivery = subscribers.email
OR contacts.email_2_delivery = subscribers.email
OR contacts.email_1_other = subscribers.email
OR contacts.email_2_other = subscribers.email
WHERE contacts.`title` != "" AND
#ADD YOUR CUSTOM WHERE STATEMENT HERE#
contacts.publications LIKE'%MAG1%' AND subscribers.confirmed = '1'
ORDER BY subscribers.email ASC
Thanks
By ross - January 27, 2017
Hi there.
Thanks for posting.
We can help you with custom MySQL via consulting.
You can contact me through consulting@interactivetools.com to continue the conversation.
In the meantime, we can leave this post here and someone in the community might have some examples.
Let me know any other questions.
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/