jj20051 Posted July 23, 2010 Share Posted July 23, 2010 Ok so I want to send an email with data I pull from MYSQL using PHP. The data contains variables that I want to be part of the email... Example Email Title: Invoice #{$invoice_id) Is Overdue $invoice_id is defined in the PHP code and the email title above is stored in mysql. The problem is it won't echo the variable in the email, but chooses to go with an exact display of the title IE like googling something with "" around it... How do I make it so that when I pull a title from MYSQL it fills in any variables {$variable} with what php has stored? Quote Link to comment Share on other sites More sharing options...
Wolphie Posted July 23, 2010 Share Posted July 23, 2010 We would need to see your code. Quote Link to comment Share on other sites More sharing options...
trq Posted July 24, 2010 Share Posted July 24, 2010 This idea wreaks of poor design and is precisely the opposite way around to how things should be done. You should be storing the value of your invoice_id within your database and then simply replacing the #{$invoice_id) text within your template with that value. If you still wish to go down the path you are on, take a look at eval, generally though, if you need to use eval your design is incorrect. Quote Link to comment Share on other sites More sharing options...
jj20051 Posted July 25, 2010 Author Share Posted July 25, 2010 This is an automated emailer that sends out invoices. I want to store the email in the database so that the admin can edit it as if it were a template for the email. I may be doing something wrong, but then again I haven't developed the admin section yet. I might need to just store them in .tpl files, but I'd rather not LOL Quote Link to comment Share on other sites More sharing options...
felixtgomezjr Posted July 25, 2010 Share Posted July 25, 2010 I am not so sure but I guess you can use the str_replace on this. Here is the step 1. Pull the data from the database. 2. Use str_replace command to replace the #{$invoice_id) with the right invoice number before sending. I hope that will help. If it makes more confusing, sorry but I need to see your code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.