Email Log - related records

3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 23, 2018   (RSS)

By Toledoh - March 21, 2018

Hi All.

I'm trying to add a Related Records field to the membership table.  The idea being that it would display all emails sent to that member.

I've created the related field choosing the _outgoing_mail table, with the MySQL Where as

to='<?php echo mysql_escape(@$RECORD['email']) ?>’

However, I get the error on the modify page of;

MySQL Error: 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 'to='XXX@XXX.com') ORDER BY createdDate DESC LIMIT 25' at line 3

Any ideas?

Cheers,

Tim (toledoh.com.au)

By Dave - March 23, 2018

Hi Tim, 

It's because MySQL considers 'to' to be a reserved fieldname so you need to put `backticks` around it to let MySQL know that it's a column name.

Try replacing to with `to` and let me know if that works for you.

Dave Edis - Senior Developer

interactivetools.com