From d9df643927c552eb3eeeb0b452fc72ec2a092fc8 Mon Sep 17 00:00:00 2001 From: Zmegolaz Date: Thu, 2 Nov 2017 21:40:51 +0100 Subject: [PATCH] fix: Use correct sensor ID when removing device. (#7611) --- includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/functions.php b/includes/functions.php index 39c0a16dd1..ac24c9e24f 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -424,7 +424,7 @@ function delete_device($id) // Remove sensors manually due to constraints foreach (dbFetchRows("SELECT * FROM `sensors` WHERE `device_id` = ?", array($id)) as $sensor) { $sensor_id = $sensor['sensor_id']; - dbDelete('sensors_to_state_indexes', "`sensor_id` = ?", array($sensor)); + dbDelete('sensors_to_state_indexes', "`sensor_id` = ?", array($sensor_id)); } $fields = array('device_id','host'); foreach ($fields as $field) {