I have a map on my site that has plots placed on it using data from my table. The plots are placed with javascript as so…
addPostCode('<?php echo $array[$UID][0]; ?>');
addPostCode('<?php echo $array[$UID][1]; ?>');
addPostCode('<?php echo $array[$UID][2]; ?>');
Somehow I need to see if the variable exists in my table, and then if so, generate an additional line and increment my array number, so based on the above 3 records, the next line would be…
addPostCode('<?php echo $array[$UID][4]; ?>');
Can I ask if this is possible?
You just need to loop through all of the members of the
$array[$UID]variable.I used
json_encode()because it does whatever escaping is necessary to make your data JavaScript-compatible.