How can conditional statements, like IF conditions, be effectively used in PHP to manipulate data retrieved from a database query?

Conditional statements, like IF conditions, can be effectively used in PHP to manipulate data retrieved from a database query by allowing you to check certain conditions before performing specific actions on the data. For example, you can use an IF condition to check if a certain value meets a criteria and then update or display the data accordingly.

// Assume $result is the result of a database query
if ($result) {
    // If the query returned some results, loop through each row
    foreach ($result as $row) {
        // Perform manipulation or display data here
        echo $row['column_name'];
    }
} else {
    // If the query returned no results, display a message
    echo "No results found.";
}