Jump to content

15 seconds of thought and I don't know what to call the subject. Sorry


FinalFrontier

Recommended Posts

Does anyone know why this isn't working?

 

$body = "
	Dear ".if ($row['customertitle'] != '') {echo $row['customertitle'].' '.$row['customerlastname'];} else (echo $row['customerfirstname'];}."
	<BR>
	This is a test. ".$_SERVER['SERVER_ADDR']."
	<BR>
	".echo $accessinformation."
";

Because you can't embed an if condition into a string like that, and you don't echo vars into a string.

 

Move your condition outside and set a variable, then embed that variable in the string.  As for your echo, just concatenate the variable.

 

 

if ($row['customertitle'] != '') {
    $name = $row['customertitle'].' '.$row['customerlastname'];
} 
else (
   $name = $row['customerfirstname'];
}
$body = "
	Dear ".$name."
	<BR>
	This is a test. ".$_SERVER['SERVER_ADDR']."
	<BR>
	".$accessinformation."
";

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.