tmyonline Posted March 16, 2009 Share Posted March 16, 2009 Hi guys, I'm having a bunch of text, paragraphs of text information, that is stored in a MySQL table. I need to embed some dynamic contents into this text so that when it is retrieved from the database, those dynamic contents will be evaluated. Here's an example of the text: Dear Mr X, Your ticket number XYZ that you created on MM:DD:YYYY has been resolved. Well, my actual text is much larger than this and consists of several paragraphs. The above line is just an illustration. In the above text, the terms "Mr X", "XYZ", and the date field "MM:DD:YYYY" are dynamic contents embeded in a large body of text. When this text body is retrieved from the database, these dynamic contents will be evaluated depending on the values passed in. So, Mr X can be Mr Green, XYZ can be 12345, and the date can be 03:12:2009. Any idea ? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/149648-how-to-embed-dynamic-content-in-a-static-text-stored-in-mysql/ Share on other sites More sharing options...
sasa Posted March 16, 2009 Share Posted March 16, 2009 use str_replace() function Quote Link to comment https://forums.phpfreaks.com/topic/149648-how-to-embed-dynamic-content-in-a-static-text-stored-in-mysql/#findComment-785892 Share on other sites More sharing options...
tmyonline Posted March 17, 2009 Author Share Posted March 17, 2009 Thanks sasa. Indeed, this is the function I need. I used it before but forgot about it. Thanks for bringing it back to my memory. Quote Link to comment https://forums.phpfreaks.com/topic/149648-how-to-embed-dynamic-content-in-a-static-text-stored-in-mysql/#findComment-786707 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.