change to SQL

This commit is contained in:
schrom01 2023-02-15 16:50:32 +01:00
parent 46021df0e5
commit 5c8dcb4ca4
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ function saveToDatabase($contentArray, $conn) {
$result1 = $conn->query($sql1);
echo "Select Query sent<br>";
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]."'";
$sql = "INSERT INTO `topics` (`id`, `lastSave`, `fullJSON`, `timeWatchM`,`timeWatchW`, `timeWatchD`, `countWatchM`, `countWatchW`, `countWatchD`) values ('".$contentArray[0]."', ".$contentArray[1]." , '".$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<br> Result: " . $result;
} else {