What is the correct syntax for an if-else statement in PHP when checking for a non-empty value in a database field?

When checking for a non-empty value in a database field using an if-else statement in PHP, you can use the empty() function to determine if the field is not empty. If the field is not empty, the if block will be executed, otherwise, the else block will be executed. You can also use isset() function to check if the field is set or not.

// Assuming $result is the database result containing the field you want to check
if (!empty($result['field_name'])) {
    // Field is not empty, do something
    echo "Field is not empty";
} else {
    // Field is empty, do something else
    echo "Field is empty";
}