jgbutler Posted March 21, 2006 Share Posted March 21, 2006 I've got a little bit of code where I fill a variable with <<< . (I'm such a newbie, I don't even know what that's called!) Like this:[code]$body=<<<_MSG_This is the body of a message._MSG_;[/code]What I'd like to do is insert some MySQL variable information into the middle of that. I tried the following, but got a parsing error. Is there a way around this?[code]$body=<<<_MSG_This is the body of a message sent to $row_rsVerify['email']_MSG_;[/code]Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/5443-using-variables-with/ Share on other sites More sharing options...
Prismatic Posted March 21, 2006 Share Posted March 21, 2006 [code]$body="<<<_MSG_This is the body of a message sent to ". $row_rsVerify['email'] ". _MSG_";[/code]Should work for you :) Quote Link to comment https://forums.phpfreaks.com/topic/5443-using-variables-with/#findComment-19468 Share on other sites More sharing options...
kenrbnsn Posted March 21, 2006 Share Posted March 21, 2006 No, that won't work. The OP is using the heredoc format. (why it's called that is lost in the antiquities of the C language... :-) ) The '<<<' is not part of the string and neither is the "_MSG_".The solution here is to use curly brackets around the array variable.[code]<?php$body=<<<_MSG_This is the body of a message sent to {$row_rsVerify['email']}_MSG_;?>[/code]Ken Quote Link to comment https://forums.phpfreaks.com/topic/5443-using-variables-with/#findComment-19471 Share on other sites More sharing options...
jgbutler Posted March 22, 2006 Author Share Posted March 22, 2006 [!--quoteo(post=357102:date=Mar 21 2006, 05:30 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Mar 21 2006, 05:30 PM) [snapback]357102[/snapback][/div][div class=\'quotemain\'][!--quotec--]No, that won't work. The OP is using the heredoc format. (why it's called that is lost in the antiquities of the C language... :-) ) The '<<<' is not part of the string and neither is the "_MSG_".The solution here is to use curly brackets around the array variable.[/quote][b]heredoc format[/b]? Man, I never would've guess that! Or the curly braces!But that's just what I needed.When you don't know the name for something, it makes it mighty hard to search for help with it. Thanks a heap!P.S. How is "heredoc" pronounced? Is it like "heretic" or "hear-dock"?! Quote Link to comment https://forums.phpfreaks.com/topic/5443-using-variables-with/#findComment-19631 Share on other sites More sharing options...
wildteen88 Posted March 22, 2006 Share Posted March 22, 2006 I pronounce it [b]here-dock[/b] myself. Quote Link to comment https://forums.phpfreaks.com/topic/5443-using-variables-with/#findComment-19639 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.