query($strSQL); // Fetch the first row $row = $query->fetch(PDO::FETCH_ASSOC); // If no results are found, echo a message and stop if ($row == false){ echo "No results"; exit; } // Print the titles using the first line print_titles($row); // Iterate over the results and print each one in a line while ($row != false) { // Print the line $line = implode( ";",array_values($row)); $line = html_entity_decode($line); $line = str_replace(array("\r\n", "\r", "\n"), "
", $line); echo $line . "\n"; // Fetch the next line $row = $query->fetch(PDO::FETCH_ASSOC); } // Prints the column names function print_titles($row){ echo implode(";",array_keys($row)) . "\n"; } ?>