The clean way is to use heredoc syntax, and modify your code like below to use only variable in the middle of html (no function call)
$color='#DADDE2';
$business=getbussinesspagination(0,$start,$per_page);
if ($business){
while ($row = $business->fetch_assoc ()){
if($color=='#DADDE2')
$color='#F9F9F9';
else
$color='#DADDE2';
}
else
{
}
$msg=<<<MYHTML
<div id="new2" style="background:#fff; width:779px; min-height:310px;">
<table align="center" width="779px" cellpadding="0" cellspacing="0" id="tb1">
<tr style="height:28px; font-size:12px;">
<td style="width:246px">Name</td>
<td style="width:145px">CITY</td>
<td style="width:102px">ABCDEF</td>
<td style="width:71px">BUDGET</td>
<td style="width:102px">MEMBERSHIP</td>
<td style="width:84px" id="td1">UNTIL</td>
</tr>
</table>
$business
MYHTML;
Alternatively, you can also use ob_start();
and ob_get_content();
to redirect the output into a variable you will use later.
ob_start();
// do all your code, nothing will be sent to screeen
echo '<div id="...';
$html = ob_get_contents();
ob_end_clean();
var_dump($out1, $out2);