close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dynamic Email Content and MySQLi Server Behaviours

Thread began 8/09/2017 12:57 pm by Accumike | Last modified 8/29/2017 1:42 pm by Ray Borduin | 84 views | 4 replies |

Accumike

Dynamic Email Content and MySQLi Server Behaviours

Hi

I am trying to send emails with dynamically generated content.

So far, using the 'Blank' template, I have managed to send an email with dynamic content, but it includes ALL the content of my d/b table, with column names as the headings in the email. This not what I want.

Instead, I have a recordset that joins several tables and requires a URL parameter to filter the data required (eg: id_prf=2 etc).

How do I then include this in the email template?

I have seen an old forum post (http://www.webassist.com/forums/posts.php?id=33942) that says to add globals for the recordset in the template page. However there is only a snippet of code and I can't get it to work.

What would be really helpful is the complete code for an example page that sends the email and an example template file with the globals included.

Hope this is clear.

Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

You should be able to just add the recordset to the Blank template filtered by the url parameter and build the page just like you would any other page.

Sign in to reply to this post

Accumike

Hi Ray

I tried this, but when I added the URL query string, I got this error message:

"..\mysite\webassist\email\templates\Blank_3.php?id_prf=<?php echo $_GET['id_prf']]; ?> was not found"

If I take out the query string (?id_prf=<?php echo $_GET['id_prf']]; ?>) then it loads OK, but I can't filter the recordset with the URL query string.

I also got a Dreamweaver error "open <%= not closed" (I am using DW CS6 on Windows Vista Business).

Any ideas?

Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

The querystring variable would automatically be available in the email if it was passed into the main page. You don't have to re-add it to the line where the email body page is like you tried in your example.

Sign in to reply to this post

Accumike

Hi Ray

SOLVED!

I have solved this following the recommendation in an earlier post: http://www.webassist.com/forums/posts.php?id=36722

Here's what I did:

1) Set up the mySQLi recordset (rsTestRecord) in the page that triggers the Universal Email server behaviour

2) Added a global variable in my template page, using this code at the top of the page:
<?php global $rsTestRecord; ?>

3) I can now display any dynamic data required in the template page using
<?php echo($rsTestRecord->getColumnVal(field_name")); ?>

My dynamic email content now works nicely, complete with images if required.

NB: I searched the forum high and low, but could not find a specific query that answered this.

Perhaps a short tutorial would help other WA users.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...