The data was inserted into the database after being escaped as follows:
$caller=htmlentities($formVarsI['caller'], ENT_QUOTES, "UTF-8");
Some of the $caller’s have single quotes e.g. O’Connor and these then look like O'Connor in the database.
I am now trying to extract the data using a REST api and below is my php:
$sql = "SELECT caller FROM tbl_calls ";
try {
$db = getConnection();
$stmt = $db->query($sql);
$calls= $stmt->fetchAll(PDO::FETCH_OBJ);
$db = null;
echo json_encode($calls);
}
My question is how to html_entity_decode on $caller so as to remove the
'
for each caller where it applies. Note there are approx. 10,000 entries in the db.
I think you should specify the quotes parameter.
By default it’s
ENT_COMPACTand it just convert double quotes, not single.