Field returning null if contains £

Field returning null if contains £

classic12classic12 Posts: 228Questions: 60Answers: 4

Hi Guys,

I am using the following getfiles.php


header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');  
include 'dbdatasurplus.php';
$query6 = "SELECT a.quoteID, a.quoteTitle , a.notes, c.web_path FROM quotes a 
            INNER JOIN users_files b on b.user_id = a.quoteID 
            INNER JOIN files c on = b.file_id 
            WHERE a.status = "."'active'"." 
            ORDER BY quoteID ASC , ASC";
//echo $query6;    
    $myArray = array();
    if ($result = $mysqli->query($query6)) 
        $tempArray = array();
        while($row = $result->fetch_object()) {
                $tempArray = $row;
                array_push($myArray, $tempArray);
        echo json_encode($myArray);

    //echo $query5;


The field a.quoteTitle returns null if it contains a '£' sign.

I also tried adding added this to the database connection php files. mysqli_set_charset("utf8")

I looked at my tables and the field was set to CP1251 West so I changed this to UTF-8 Unicode.

Still having the same issue.


Steve Warby


  • allanallan Posts: 55,114Questions: 1Answers: 8,654 Site admin

    Hi Steve,

    This looks like a PHP / MySQL question, so you'd be best asking generic programming questions like this in StackOverflow, rather than here, which is specifically for DataTables.

    My best suggestion would be to use SET NAMES='utf8' in a query, but it might be that is what mysqli_set_charset is doing.


This discussion has been closed.