From 46021df0e5747aac8a92da944538d7f0b6824485 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Wed, 15 Feb 2023 14:44:27 +0100 Subject: [PATCH] change to SQL --- dataCollector/dataCollector.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dataCollector/dataCollector.php b/dataCollector/dataCollector.php index 805a473..d4af269 100644 --- a/dataCollector/dataCollector.php +++ b/dataCollector/dataCollector.php @@ -31,8 +31,7 @@ function saveToDatabase($contentArray, $conn) { $sql1 = "SELECT * FROM `topics` WHERE id='".$contentArray[0]."'"; $result1 = $conn->query($sql1); echo "Select Query sent
"; - - if(!mysql_num_rows($result1)) { + if($result1->num_rows === 0) { $sql = "INSERT INTO `topics` (`id`, `fullJSON`, `timeWatchM`,`timeWatchW`, `timeWatchD`, `countWatchM`, `countWatchW`, `countWatchD`) values ('".$contentArray[0]."', '".$contentArray[2]."', ".$contentArray[3].", ".$contentArray[4].", ".$contentArray[5].", ".$contentArray[6].", ".$contentArray[7].", ".$contentArray[8].") ON DUPLICATE KEY UPDATE `id` = '".$contentArray[0]."'"; $result = $conn->query($sql); echo "Insert Query sent
Result: " . $result;