I'm working on a function that tries to do an UPDATE query using PDO, when I run the following error message can anyone suggest what is wrong?:
Call to a member function bind_param() on boolean in... line 89
My Code :-
public function updateForecast($UID, $lat, lng) {
$forecast = new Forecast('xxxxxxxxxxxxxxxxxxxxxx');
$hub_forecast = $forecast->get($lat,$lng);
$current_forecast = (is_object($hub_forecast) && isset($hub_forecast->currently)) ? $hub_forecast->currently : NULL;
$temperature = (is_object($current_forecast) && isset($current_forecast->temperature)) ? ($current_forecast->temperature - 32) / 1.8 : '';
$precipitation = (is_object($current_forecast) && isset($current_forecast->precipProbability)) ? $current_forecast->precipProbability : '';
$humidity = (is_object($current_forecast) && isset($current_forecast->humidity)) ? ($current_forecast->precipProbability * 100) : '';
$status = (is_object($current_forecast) && isset($current_forecast->summary)) ? $current_forecast->summary : '';
$temperature_feels = (is_object($current_forecast) && isset($current_forecast->apparentTemperature)) ? ($current_forecast->apparentTemperature - 32) / 1.8: '';
$sql = "UPDATE weather_data SET
temperature = ?,
precipitation= ?,
humidity = ?,
status = ?,
temperature_feels = ?
WHERE UID = ?";
$stmt = $this->db->prepare($sql);
$stmt->bind_param('ssssss', $UID, $temperature, $precipitation, $humidity, $status, $temperature_feels); // line 89
$stmt->execute();
$this->db->commit();
$stmt->close();
}
// Running the query with lat/lng values (first parameter is an internal unique identifier)
updateForecast('12356','52.490074299999996','-1.9119724');