I would like to put if else in the variable "type" then it will display the following html code below but it displays the error of syntax error, unexpected T_IF error in php
$data .='<tr>
<td>'.$number.'</td>
<td>'.$EventName.'</td>
<td>'.$Type.'</td>
<td>'.$Gender.'</td>
<td>'.$RegistrationFee.'</td>
<td>'.$EntryLimit.'</td>
<td>'.$Rating.'</td>'
.if ($Type=="Singles"){.'
<td>
<button onclick="JoinTournament('.$row['Tournament_EventID'].')" class="btn btn-danger">Join</button>
</td>'
.}.
'</tr>';
$number++;
}
} else {
$data .= '<tr><td colspan="9" style="text-align:center">No records found</td></tr>';
}
$data .='</table>';
echo $data;
}