"PDO" and "mysqli_*" are two separate APIs. Do not mix them.
return $retunValue;, yet the call to it throws away the return value.
$string = json_encode($retunValue);
will product a string, that you can
echo into the result.
Is the "platform" expecting HTML output? Or just JSON text? If the latter, you need this as the first statement that emits output:
Bottom line: This might be all you need:
header('Content-Type: application/json'); echo json_encode($retunValue);
(I have not checked for other issues.)