Well it looks like rowcolor is a function that you wrote, and that function probably looks something like this:
function rowcolor($colorID) {
switch($colorID) {
case 1:
echo "#FFFFFF";
break;
case 2:
echo "#000000";
break;
}
}
If that is a correct assumption then what is happening is that while PHP is processing your first echo statement it gets told to hold that operation while it goes and runs the function rowcolor(). That function tells php that it needs to echo the color specified that means that that color gets echoed before your suspened echo statement finishes processing. Then PHP goes back to your first echo statement and completes and since rowcolor() doesn't return anything nothing gets added to the echo string where you are expecting it to.
Give the 1st example you have below your rowcolor function should look something like this:
function rowcolor($colorID) {
switch($colorID) {
case 1:
return "#FFFFFF";
break;
case 2:
return "#000000";
break;
}
}
And now to make your 2nd example work you'd have to write it like this:
echo '<tr bgcolor="';
echo rowcolor(0);
echo '"><td>Goals - Overtime :</td></tr>';