将SQL查询导出为CSV错误

I have a script that outputs a SQL query to a CSV file, which works ok but as soon as the content exported contains a ':' only text up until the ':' is displayed.

<?php 
include 'connect.php';
date_default_timezone_set('Europe/London');
    $date = date('Y-m-d');
    //echo $date;
if(isset($_POST['export_query'])){

        $querytemp=$_POST['export_query'];

        }

//$querytemp = "SELECT * FROM poc_report_live WHERE Date = '$date'";

$result = mysql_query($querytemp);
//if (!$result) die($querytemp);
if (!$result) die('Couldn\'t fetch records');
$num_fields = mysql_num_fields($result);
$headers = array();
for ($i = 0; $i < $num_fields; $i++) {
    $headers[] = mysql_field_name($result , $i);
}
$fp = fopen('php://output', 'w');
if ($fp && $result) {
    header('Content-Type: text/csv');
    header('charset = UTF-8');
    header('Content-Disposition: attachment; filename="export.csv"');
    header('Pragma: no-cache');
    header('Expires: 0');
    fputcsv($fp, $headers);
    while ($row = mysql_fetch_array($result, MYSQLI_NUM)) {
        fputcsv($fp, array_values($row));
    }
    die;
}
?>