A conversion to ternary is not going to save you much. If this code is used many time convert it to a function that you can call.
function setSelectedClass($selected) {
if(true == $selected) {
$row = "<tr align='center' class='selected_row'>";
} else {
echo "<tr align='center' class='red_bg'">;
}
return $row
}
Now you don't have to have even ternary statements sprinkled all over and if you want you can use a ternary condition in the function like this:
function setSelectedClass($selected) {
$row = "<tr align='center' class='" . (true == $selected ? "selected_row" : "red_bg") . "'>";
return $row;
}
Once you have the function in place you just call it:
setSelectedClass(true);
This will save you a lot of code. Anytime you are repeating code, as you are finding that you do, consider creating a function.