I am getting the error: Message: layerName parameter is not passed in GetPOI request. Fatal error: Call to a member function prepare() on a non-object
here's where i create the PDO $db
function connectDb() {
try {
$dbconn = 'mysql:host=' . DBHOST . ';dbname=' . DBDATA ;
$db = new PDO($dbconn , DBUSER , DBPASS );
// set the error mode to exceptions
$db->setAttribute(PDO::ATTR_ERRMODE , PDO::ERRMODE_EXCEPTION);
return $db;
}//try
catch(PDOException $e) {
error_log('message:' . $e->getMessage());
}// catch
}// connectDb
and here is where the error occurs:
// $sql is returned as a PDO statement object.
$sql = $db->prepare( 'SELECT id,
imageURL,
title,
description,
footnote,
lat,
lon,
(((acos(sin((:lat1 * pi() / 180)) * sin((lat * pi() / 180)) +
cos((:lat2 * pi() / 180)) * cos((lat * pi() / 180)) *
cos((:long - lon) * pi() / 180))
) * 180 / pi()
)* 60 * 1.1515 * 1.609344 * 1000
) as distance,
iconID,
objectID,
transformID
FROM POI
WHERE POI.poiType = "geo"
HAVING distance < :radius
ORDER BY distance ASC
LIMIT 0, 50 ' );
have I not set up the $db correctly? I can also post the whole script if it helps. Thanks.
$db.