FQL statement has executed and array object has been passed to $fqlResult successfully.
However, I’m unable to write name into my <span> through innerHTML. Neither exceptions nor errors have occurred. Other columns from the table such as latitude, longitude, page_id, checkin_count are able to write into respective <span> correctly. Only name is giving me problem.
May I know what is preventing me from writing name into my <span>?
FQL Statement
SELECT page_id,name,latitude,longitude,checkin_count
FROM place
WHERE distance(latitude, longitude,"1.2894680406278", "103.86311775635") < 200
ORDER BY checkin_count DESC
Results from print_r($fqlResult) appears to be consistent with results from Graph API Explorer.
HTML
<b>Page Name: </b> <span id="fName"></span>
<b>Latitude: </b> <span id="fLatitude"></span>
<b>Longitude: </b> <span id="fLongitude"></span>
Observation
JavaScript Setup 1 (Blockage)
document.getElementById('fName').innerHTML = <?=$fqlResult[0]['name']?>;
document.getElementById('fLatitude').innerHTML = <?=$fqlResult[0]['latitude']?>;
document.getElementById('fLongitude').innerHTML = <?=$fqlResult[0]['longitude']?>;
//Output
No. of Facebook Checkins:
Latitude:
Longitude:
JavaScript Setup 2 (No blockage – Okay)
document.getElementById('fLatitude').innerHTML = <?=$fqlResult[0]['latitude']?>;
document.getElementById('fLongitude').innerHTML = <?=$fqlResult[0]['longitude']?>;
//Output
No. of Facebook Checkins:
Latitude: 1.2894680406278
Longitude: 103.86311775635
Latitude and logitude are numbers, so no problem there.
But name is a string (a.k.a. text literal), and what did you forget to put around the value in your JavaScript code …? Exactly, string delimiters.
You should really learn how to work with your browser’s error console …!