Troubleshooting “Unexpected T_ECHO” in ternary operator statement

The Ternary operator is not identical to an if-then. You should have written it

echo ($DAO->get_num_rows() == 1) ? "is" : "are";

It returns the value in the 2nd or 3rd position. It does NOT execute the statement in the 2nd or 3rd position.

Leave a Comment