What fetch-mode in PDO can be used to simplify querying related tables in PHP?

When querying related tables in PHP using PDO, the fetch mode `PDO::FETCH_ASSOC` can be used to simplify the process. This fetch mode returns an associative array where the keys are the column names of the result set. By using this fetch mode, you can easily access the related table data using the column names as keys in the associative array.

// Connect to the database
$pdo = new PDO("mysql:host=localhost;dbname=mydatabase", "username", "password");

// Prepare and execute a query to fetch data from related tables
$stmt = $pdo->prepare("SELECT t1.*, t2.* FROM table1 t1 JOIN table2 t2 ON t1.id = t2.table1_id");
$stmt->execute();

// Fetch data using PDO::FETCH_ASSOC
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    // Access related table data using column names as keys
    echo $row['column_name'];
    // Other processing of the fetched data
}